简单TJ
2026-08-19 22:58:18
发布于:安徽
4阅读
0回复
0点赞
看注释
#include<bits/stdc++.h>
using namespace std;
char ch[114514];//栈
int top;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] != '@')ch[++top] = s[i];//若不是删除符,则入栈
else if (top > 0)top--;//反之,去栈顶
}
for (int i = 1; i <= top; i++) {
cout << ch[i];//输出
}
return 0;
}
当然
if (s[i] != '@')ch[++top] = s[i];
else if (top > 0)top--;
}
也可写作____________________________________________________
______________________________________(填空)
这里空空如也



有帮助,赞一个