You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
778 B

#include <bits/stdc++.h>
using namespace std;
int main() {
//输入+输出重定向
//freopen("../x.in", "r", stdin);
//freopen("../x.out", "w", stdout);
string s;
getline(cin, s);
stack<char> st;
for (int i = 0; i < s.size(); ++i) {
if (s[i] != '@' && s[i] != '#') {
st.push(s[i]);
} else if (s[i] == '@') {
while (!st.empty()) st.pop();
} else if (s[i] == '#') {
//删除一个
st.pop();
}
}
string result = "";
//输出结果
while (!st.empty()) {
result = st.top() + result;
st.pop();
}
cout << result << endl;
//关闭文件
//fclose(stdin);
//fclose(stdout);
return 0;
}