Simple Queue
Implement a data structure called a "queue". Write a program that defines the queue and simulates its operations by implementing all the methods specified below. The program will read a sequence of commands and execute the corresponding operation for each command. After executing each command, the program should output one line. The possible commands are:
push n
Add the number n
to the queue (the value n
is specified after the command). The program should output ok.
pop
Remove the first element from the queue and output its value.
front
Output the value of the first element without removing it from the queue.
size
Output the number of elements currently in the queue.
clear
Clear all elements from the queue and output ok.
exit
Output bye and terminate the program.
It is guaranteed that the input commands meet the following conditions: the maximum number of elements in the queue at any time does not exceed 100, and all pop and front commands are valid, meaning there is at least one element in the queue when these commands are executed.
Input
As described in the conditions. Refer to the example of input data.
Output
As described in the conditions. Refer to the example of output data.