Error-Correcting Queue
Implement a data structure called a "queue". Write a program that includes a description of 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 based on the command. After executing each command, the program should output a single line. The possible commands for the program 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. The program should output its value.
front
Output the value of the first element without removing it from the queue.
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 and pop operations, the program should check if there is at least one element in the queue. If the input data contains the front or pop operation and the queue is empty, the program should output the string error instead of a numerical value.
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.