#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
stack<char>vis1,vis2;
char a[105];
gets(a);
n=strlen(a);
for (int i=0;i<n;i++)
{
if(a[i]=='@')
{
while (!vis1.empty())
vis1.pop();
continue;
}
if(a[i]=='#')
{
vis1.pop();
continue;
}
vis1.push(a[i]);
}
while (!vis1.empty())
{
vis2.push(vis1.top());
vis1.pop();
}
while (!vis2.empty())
{
char t=vis2.top();
cout<<t;
vis2.pop();
}
cout<<endl;
return 0;
}
OJ--1624 程序员的输入(简单的栈)
最新推荐文章于 2024-04-11 16:32:21 发布