求帮忙
#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
stack <int> a;
int find(){
stack <int> b;
int maxn=0;
b = a;
while(!b.empty()){
if(b.top()>maxn) maxn = b.top();
b.pop();
}
cout << maxn;
return maxn;
}
int main(){
int n;
cin >> n;
for(int i = 0;i < n;i++){
char c;
c = getchar();
if (c == '0') {int x;cin >> x,a.push(x);}
else if(c == '1') a.pop();
else if(c == '2' ) find();
}
return 0;
}