提交时间:2024-04-06 09:04:26
运行 ID: 141618
#include<bits/stdc++.h> using namespace std; char s[111111]; int top = 0; bool empty() { return top==0; } void push(char t) { s[top++]=t; } void pop1() { if(!empty()) top--; } void pop2() { top = 0; } int main() { char t; while(cin >> t) { if(t =='#') { pop1(); } else if(t =='@') { pop2(); } else { push(t); } } for(int i = 0; i < top; i++) { cout << s[i]; } return 0; }