Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
143120 | C班詹皓杰 | 行编辑程序 | C++ | 通过 | 100 | 0 MS | 256 KB | 460 | 2024-04-12 22:49:42 |
#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; }