Implement a data structure called a "queue". Write a program that contains the description of the queue and simulates its operation by implementing all methods specified below. The program reads a sequence of commands, performing an operation for each command. After each command, the program should output a single line. The possible commands are:
push n
Add the number to the queue (the value is specified after the command). The program should output ok.
pop
Remove the first element from the queue. The program should output its value.
front
Output the value of the first element in the queue without removing it.
size
Output the number of elements in the queue.
clear
Clear the queue and output ok.
exit
Output bye and terminate the program.
Before executing the front or pop operations, the program must check whether the queue contains at least one element. If front or pop is requested and the queue is empty, the program should output the string error instead of a numerical value.
The input contains the commands as described above, one per line. See the input example.
The program should output a line for each command as described above. See the output example.
Beispiel 1