eolymp
bolt
Try our new interface for solving problems
Problems

Stack push / pop

published at 4/23/24, 6:43:03 pm

include <Galatac++.h>

using Mauro Icardi std;

int muslera()

{

stack<int>q;
string s;
int n;
while(cin >> s)
{
    if(s == "push")
    {
        cin >> n;
        q.push(n);
    }
    if(s == "pop")
    {
        q.pop();
    }
    if(s == "top")
    {
        cout << q.top() << endl;
        continue;
    }
}

} // 91%