Write a generic class TwoStackQueue<T> with two stacks: enqueue pushes on the inbox; dequeue pops from the outbox, and only when the outbox is empty pours the whole inbox into it (count each element moved as a transfer). An empty queue throws NoSuchElementException.
TwoStackQueueApp simulates a service desk: in NAME joins the queue, out serves the next person (served Lina or nobody is waiting). At the end print how many are still waiting, the number of transfers, and whether each element was moved at most once.
For the input
in A in B in C out in D out out out out
the program prints
served A
served B
served C
served D
nobody is waiting
Still waiting: 0
Enqueued 4, transfers between stacks: 4
Each element is moved at most once: true