Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141772 | 罗嘉为 | 行编辑程序 | C++ | 通过 | 100 | 0 MS | 256 KB | 400 | 2024-04-06 10:58:08 |
#include <bits/stdc++.h> using namespace std; char a[110000]; int ans = 0; bool empty(){ return ans == 0; } void push(char t){ a[ans++] = t; } void pop(){ if(!empty()) ans--; } void pop1(){ ans = 0; } int main(){ char t; while(cin >> t){ if(t == '#') pop(); else if(t == '@') pop1(); else push(t); } for(int i = 0; i < ans; i++) cout << a[i]; return 0; }