提交时间:2024-04-06 08:47:56

运行 ID: 141604

#include<iostream> #include<cstdio> using namespace std; int siz; string s; bool empty(){ return siz==0; } void push(char ch){ s[siz++]=ch; } void poper(){ if(!empty()) siz--; } void popest(){ siz=0; } int size(){ return siz; } int main(){ string c; int i=1; while(cin>>c[i]){ if(c[i]=='#') poper(); else if(c[i]=='@') popest(); else push(c[i]); i++; } for(int i=1;i<=size();i++) cout<<s[i]; return 0; }