提交时间:2024-04-06 09:14:30
运行 ID: 141633
#include<bits/stdc++.h> using namespace std; stack<char> st; char a1[114514]; int cnt; int main(){ string a; getline(cin,a); int len=a.length(); for(int i=0;i<len;i++){ if(a[i]=='#'){ st.pop(); } else if(a[i]=='@'){ while(!st.empty()){ st.pop(); } } else{ st.push(a[i]); } } while(!st.empty()){ a1[cnt++]=st.top(); st.pop(); } for(int i=cnt-1;i>=0;i--){ cout<<a1[i]; } return 0; }