Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141592 谢思涵 行编辑程序 C++ 解答错误 0 0 MS 260 KB 503 2024-04-06 08:42:43

Tests(0/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; }