#C7226. Queue Operations Simulation

    ID: 51074 Type: Default 1000ms 256MiB

Queue Operations Simulation

Queue Operations Simulation

This problem involves simulating operations on a queue data structure. You are required to implement a queue that supports the following operations:

  • ENQUEUE x: Insert an integer x into the queue.
  • DEQUEUE: Remove the element at the front of the queue (if it exists).
  • FRONT: Output the element at the front of the queue.
  • SIZE: Output the number of elements in the queue.
  • ISEMPTY: Output YES if the queue is empty; otherwise, output NO.

Your program will read a sequence of operations from the standard input and produce corresponding outputs (one per line) for operations that require an output (FRONT, SIZE, and ISEMPTY).

inputFormat

The input begins with an integer n representing the number of operations. The following n lines each contain a single operation, which can be one of the following:

  • ENQUEUE x (where x is an integer) to insert an element into the queue.
  • DEQUEUE to remove the element at the front of the queue.
  • FRONT to display the element at the front of the queue.
  • SIZE to display the number of elements currently in the queue.
  • ISEMPTY to display whether the queue is empty.

outputFormat

For every operation that requires an output (FRONT, SIZE, and ISEMPTY), print the result on a new line. The output for ISEMPTY should be YES if the queue is empty, and NO otherwise.

## sample
8
ENQUEUE 5
ENQUEUE 10
FRONT
DEQUEUE
FRONT
SIZE
DEQUEUE
ISEMPTY
5

10 1 YES

</p>