如题
#include <bits/stdc++.h>
using namespace std;
long long int gcd(int a,int b)
{
return b ? gcd(b,a%b) : a;
}
int main()
{
int qpwoeiruty;
cin>>qpwoeiruty;
for(int alskdjfhg=1;alskdjfhg<=qpwoeiruty;alskdjfhg++)
{
stack <unsigned long long int> a;
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
char p[9]={' ',' ',' ',' ',' ',' ',' '};
cin>>p+1;
int len=0;
for(int j=1;;j++)
{
if(p[j]==' ')
{
break;
}else{
len++;
}
}
if(p[1]=='p'&&p[2]=='u')
{
int q;
cin>>q;
a.push(q);
}
if(p[1]=='p'&&p[2]=='o')
{
if(a.size()==0)
{
cout<<"Empty"<<endl;
continue;
}else{
a.pop();
}
}
if(p[1]=='q')
{
if(a.size()==0)
{
cout<<"Anguei!"<<endl;
continue;
}else{
cout<<a.top()<<endl;
}
}
if(p[1]=='s')
{
cout<<a.size()<<endl;
}
}
}
return 0;
}