Problems
A queue is a data structure where the first data to enter is also the first to be removed.
This structure is known as FIFO (First In, First Out).
Queues are very common in daily life. A typical example is standing in line.
When waiting at a bank counter or for a bus, the person who arrives first is served first. (Do not consider cutting in line.)
Design a queue as described and perform operations according to the following conditions.
Operations
The commands given are as follows:
"i a"— Insert the numberainto the queue. Here,ais a natural number less than or equal to 10,000."o"— Remove and output the first element from the queue. If the queue is empty, output"empty"."c"— Output the number of elements currently in the queue.
Input
The first line contains
N, the number of commands. (1 ≤ N ≤ 100)The following
Nlines each contain one command, either"i a","o", or"c".
Output
For each command that produces output, print the result on a separate line.
There is always at least one output.
Example
7
i 7
i 5
c
o
o
o
c
2
7
5
empty
0