iterative, use 2 stacks