#include using namespace std; int main() { //输入+输出重定向 //freopen("../x.in", "r", stdin); //freopen("../x.out", "w", stdout); string s; getline(cin, s); stack 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; }