package com.aim.getoff;
import java.util.Stack;
public class Twostack {
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node) {
stack1.push(node);
}
public int pop() {
while(!stack1.empty()){
stack2.push(stack1.pop());
}
int first = stack2.pop();
while(!stack2.empty()) {
stack1.push(stack2.pop()) ;
}
return first;
}
public static void main(String[] args) {
Twostack queue = new Twostack();
/*queue.push(1);
queue.push(2);
queue.push(3);*/
queue.push(4);
queue.push(5);
System.out.println(queue.pop());
}
}