#K83677. Remove Customer from Queue

    ID: 36251 Type: Default 1000ms 256MiB

Remove Customer from Queue

Remove Customer from Queue

You are given a queue of customer IDs and a specific customer ID that needs to be removed from the queue. If the customer ID exists in the queue, remove only the first occurrence of that customer ID. If the customer ID does not exist in the queue, the queue remains unchanged.

Formally, let \( Q = [q_1, q_2, \dots, q_n] \) be the queue and let \( c \) be the given customer ID. You are to compute the updated queue \( Q' \) as follows:

[ Q' = \begin{cases} [q_1, \dots, q_{i-1}, q_{i+1}, \dots, q_n] & \text{if } q_i = c \text{ for the smallest } i \text{ such that } q_i = c,\ Q & \text{if } c \text{ is not in } Q. \end{cases} ]

The output should list the resulting customer IDs separated by a single space. If the queue is empty, output nothing.

inputFormat

The input is given in the following format from standard input (stdin):

  1. An integer \( n \) representing the number of customers in the queue.
  2. A line with \( n \) space-separated integers representing the customer IDs in the queue.
  3. An integer \( c \) representing the customer ID to remove.

outputFormat

Print the updated queue as a single line of space-separated integers to standard output (stdout). If the updated queue is empty, print nothing.

## sample
5
101 202 303 404 505
303
101 202 404 505

</p>