Implement a first-in first-out (FIFO) queue using only two stacks. The implemented queue should support all standard queue functions: push, pop, peek, and empty.
push(x)— pushes elementxto the back of the queue.pop()— removes and returns the element from the front of the queue.peek()— returns the element at the front of the queue.empty()— returnstrueif the queue is empty,falseotherwise.
Example:
Input: push 1 push 2 peek pop empty Output: 1 1 false
Constraints:
- 1 ≤ x ≤ 9
- At most 100 calls total.
popandpeekare always called on a non-empty queue.
Input format: One command per line. push X enqueues X. pop prints and removes front. peek prints front. empty prints true or false.
Output format: Print a result line for pop, peek, and empty.