#C4116. Library Management System

    ID: 47619 Type: Default 1000ms 256MiB

Library Management System

Library Management System

You are tasked with implementing a library management system. In this system, each book is identified by a unique positive integer. The library supports the following operations:

  • ADD <identifier>: Add a book with the given identifier.
  • REMOVE <identifier>: Remove the book with the given identifier.
  • CHECK <identifier>: Check if a book with the given identifier exists in the library. Print "YES" if it exists, and "NO" otherwise.
  • ALL: Print all book identifiers in ascending order separated by a space.
  • END: Terminate the input.

The input will be given line by line. For commands that require an output (CHECK and ALL), output the result immediately on a new line. All input should be read from standard input and all output should be printed to standard output.

The operations are carried out in the order they appear until the "END" command is encountered. Your solution should process all commands accordingly.

inputFormat

The input consists of several lines. Each line contains one command as described above. The input is terminated with the command "END".

outputFormat

For every command that requires a response (namely, CHECK and ALL), output the result on a new line in the order the commands appear.## sample

ADD 3
CHECK 3
END
YES