Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Created February 9, 2015 13:32
Show Gist options
  • Save theoremoon/0a4b183a37b020f8db28 to your computer and use it in GitHub Desktop.
Save theoremoon/0a4b183a37b020f8db28 to your computer and use it in GitHub Desktop.
/*
* AOJ 10032
* AC
*/
#include <stack>
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
stack<char> st;
while(true) {
cin >> s;
if (s == "quit") break;
if (s == "push") {
char c; cin >> c;
st.push(c);
} else if (s == "pop") {
cout << st.top() << endl; st.pop();
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment