import java.util.*; public class Main{ static Stack<Integer> stack1 = new Stack<Integer>(); static Stack<Integer> stack2 = new Stack<Integer>(); public static void add(int a){ stack1.push(a); if(stack2.isEmpty()){ while(!stack1.isEmpty(...