Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
143120 C班詹皓杰 行编辑程序 C++ Accepted 100 0 MS 256 KB 460 2024-04-12 22:49:42

Tests(14/14):


#include<iostream> #include<stack> #include<string> #include<algorithm> using namespace std; stack<char> s; string ans; int main(){ char c; while(cin>>c){ if(c == '@'){ while(!s.empty()){ s.pop(); } } else if(c == '#'){ if(!s.empty()){ s.pop(); } } else{ s.push(c); } } while(!s.empty()){ ans.push_back(s.top()); s.pop(); } reverse(ans.begin(),ans.end()); cout<<ans; return 0; }


Judgement Protocol: