提交时间:2023-12-30 10:37:54
运行 ID: 118386
#include<bits/stdc++.h> using namespace std; stack<char>q; int main() { string s; getline(cin,s); int len=s.size(); for(int i=0;i<len;i++) { if(s[i]!='#'&&s[i]!='@') { q.push(s[i]); } else if(s[i]=='#') { q.pop(); } else if(s[i]=='@') { while(!q.empty()) { q.pop(); } } } while(!q.empty()) { cout<<q.top(); q.pop(); } return 0; }