提交时间:2024-01-05 13:28:42
运行 ID: 119271
#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--; } } }