#C12878. Book Collection Manager

    ID: 42353 Type: Default 1000ms 256MiB

Book Collection Manager

Book Collection Manager

Your task is to implement a simple book collection manager that supports several operations on a collection of books. Each book has a title, author, and publication year. The operations you must handle include:

  • ADD title author year: Add a new book. If a book with the same title already exists in the collection, ignore the command.
  • REMOVE title: Remove the book with the specified title. Print Removed if the book was removed, or Not Found if it did not exist.
  • SEARCH title: Search for a book by title. If found, output the book details in the format title author year; otherwise output Not Found.
  • LIST: List all books in the collection in increasing order by their title. Each book should be printed on its own line in the format title author year. If there is no book, output No Books.

The input and output should be handled via standard input and standard output respectively.

Note: In this problem, assume that both title and author do not contain spaces. Also, the year is an integer.

The basic complexity of the operations can be considered as \(O(n \log n)\) in the worst case for sorting during listing.

inputFormat

The first line contains an integer n indicating the number of commands. Each of the next n lines contains one command. The command is one of the following four types:

  • ADD title author year
  • REMOVE title
  • SEARCH title
  • LIST

Commands are processed sequentially.

outputFormat

For each command that produces output, print the result on its own line:

  • For REMOVE, output Removed if the book existed and was removed, or Not Found otherwise.
  • For SEARCH, output the details of the book in the format title author year if found; otherwise, output Not Found.
  • For LIST, output all books (one per line) sorted in increasing order by title. If there are no books, output No Books.

Commands such as ADD do not produce any output.

## sample
5
ADD ToKillAMockingbird HarperLee 1960
ADD NineteenEightyFour GeorgeOrwell 1949
REMOVE ToKillAMockingbird
SEARCH NineteenEightyFour
LIST
Removed

NineteenEightyFour GeorgeOrwell 1949 NineteenEightyFour GeorgeOrwell 1949

</p>