#include<iostream>
#include<stack>
using namespace std;
class solution{
public:
void push(int value)
{
}
pop()
{
}
private:
stack<int> stack1;
stack<int>stack2;
};
int solution::pop()
{
while (!stack1.empty())
{
int temp;
temp = stack1.top();
stack1.pop();
stack2.push(temp);
}
int re = stack2.top();
stack2.pop();
while (!stack2.empty())
{
int temp;
temp = stack2.top();
stack2.pop();
stack1.push(temp);
}
return re;
}
#include<stack>
using namespace std;
class solution{
public:
void push(int value)
{
}
pop()
{
}
private:
stack<int> stack1;
stack<int>stack2;
};
int solution::pop()
{
while (!stack1.empty())
{
int temp;
temp = stack1.top();
stack1.pop();
stack2.push(temp);
}
int re = stack2.top();
stack2.pop();
while (!stack2.empty())
{
int temp;
temp = stack2.top();
stack2.pop();
stack1.push(temp);
}
return re;
}