Inception (UVA 13055) by return_zukky
Contest: 3738    RunID: 20173723    Status: Accepted    Date: Sat Oct 14 14:16:50 JST 2017


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  stack<string>st;
  string s,t;
  cin>>n;
  while(n--){
    cin>>s;
    if(s=="Kick"){
      if(!st.empty())st.pop();
    }
    else if(s=="Test"){
      if(!st.empty())cout<<st.top()<<endl;
      else cout<<"Not in a dream"<<endl;
    }
    else{
      cin>>t;
      st.push(t);
    }
  }
}