Queue of unlimited size#6127

Queue of unlimited size

1 second
256 megabytes
Very easy

Implement the data structure queue. Write a program that includes a description of the queue and simulates its operations by implementing all the methods specified below. The program reads a sequence of commands and performs the corresponding operation based on the command. After executing each command, the program should output one line. The possible commands for the program 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 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.

The size of the queue should only be limited by the available RAM. Before performing the front and pop operations, the program should check if there is at least one element in the queue. If the input data contains a front or pop operation and the queue is empty, the program should output error instead of a numerical value.

Input

As described in the conditions. Refer to the example input data for guidance.

Output

As described in the conditions. Refer to the example output data for guidance.

Examples

Example 1

Loading
Loading