#include <iostream>
#include <stack>
using namespace std;
void printStack(stack<int> st) {
while (!st.empty()) {
cout << st.top() << ' ';
st.pop();
}
}
int main ()
{
stack<int> st;
for (int i = 0; i < 5; i++)
st.push(i);
printStack(st);
st.pop();
st.pop();
cout << endl;
printStack(st);
return 0;
}
/*
run:
4 3 2 1 0
2 1 0
*/