Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
119271 | 吴悠 | 行编辑程序 | C++ | 通过 | 100 | 0 MS | 264 KB | 663 | 2024-01-05 13:28:42 |
#include <iostream> using namespace std; int top = 0, ttop = 0; char a[114514]; string c; void push(char x) { a[top++] = x; } void pop() { top--; } void popl() { top = 0; } bool empty() { if (top == 0) { return true; } else return false; } int main() { while (getline(cin,c)) { ttop=0; for (int i = 0; i < c.length(); i++) { if (c[i] == '#' && empty() == false) { pop(); } else if (c[i] == '@' && empty() == false) { popl(); } else if(c[i]=='#' || c[i] == '@'){ } else push(c[i]); } while (empty() == false) { cout << a[ttop++]; top--; } } }