Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- string s,t;
- int n,sp[1000],sg[1000],x,rp=0,rg=0;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cin>>s>>t;
- if(s=="dziekuje")
- { cin>>x;
- if(t=="plytki")
- {
- sp[rp]=x;
- rp++;
- }
- else
- {
- sg[rg]=x;
- rg++;
- }
- }
- else
- {
- if(t=="plytki")
- { if(rp>0){
- cout<<sp[rp-1]<<endl;
- rp--;}
- }
- else
- { if(rg>0){
- cout<<sg[rg-1]<<endl;
- rg--;}
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement