提交时间:2023-12-30 11:13:20

运行 ID: 118428

#include<bits/stdc++.h> using namespace std; int top=0,ttop=0; char a[114514]; char c; void push(){ a[top++]=c; } void pop(){ top--; } void popl(){ top=0; } bool empty(){ if(top==0){ return true; } else return false; } int main(){ while(cin>>c){ if(c=='#' && empty()==false){ pop(); } else if(c=='@' && empty()==false){ popl(); } else push(c); } while(empty()==false){ cout<<a[ttop++]; top--; } }