#include<iostream>
#include<cstring>
using namespace std;
int main(){
int a[100];
int n;
char c;
cin>>n;
int top=-1;
while(n--){
cin>>c;
if(c=='P'){
int x;
cin>>x;
a[++top]=x;
}
if(c=='O'){
while(-1!=top){
top--;}
}
if(c=='A'){
if(-1==top){cout<<'E';}
else
{printf("%d\n",a[top]);}
}
}
system ("pause");
return 0;
}
栈的使用
最新推荐文章于 2022-10-06 11:08:31 发布