#include #include #include using namespace std; struct Stack { stack A; void push(int n) { A.push(n); } int back() const { return A.top(); } int pop() { int t = back(); A.pop(); return t; } int size() const { return A.size(); } void clear() { stack tmp; A.swap(tmp); } }; int main() { Stack st; string s; cin >> s; while (s != "exit") { if (s == "push") { int n; cin >> n; st.push(n); cout << "ok\n"; } else if (s == "pop") { cout << st.pop() << '\n'; } else if (s == "back") { cout << st.back() << '\n'; } else if (s == "size") { cout << st.size() << '\n'; } else if (s == "clear") { st.clear(); cout << "ok\n"; } cin >> s; } cout << "bye\n"; return 0; }