Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141600 谢思涵 行编辑程序 C++ 运行出错 64 0 MS 256 KB 522 2024-04-06 08:46:14

Tests(9/14):


#include <iostream> #include <stack> #include <string> using namespace std; stack <char> a; string res; int main() { string s; getline(cin, s); int len = s.size(); for(int i = 0; i < len; i++) { if(s[i] == '@') { while(!a.empty()) a.pop(); } else if(s[i] == '#') { if(!a.empty()) a.pop(); } else a.push(s[i]); } int cur = 0; while(!a.empty()) { res[++cur] = a.top(); a.pop(); } for(int i = cur; i >= 1; i--) cout << res[i]; cout << endl; return 0; }