#C9881. Library Inventory Management

    ID: 54023 Type: Default 1000ms 256MiB

Library Inventory Management

Library Inventory Management

Implement a library management system that supports adding books, searching for books by an author, and listing books published within a specified year range. Each book is defined by its title, author, publication year, and genre. For search and listing operations, the matching books should be sorted in lexicographical order of their titles. The output format for each book is given by: \(\texttt{ by () - }\).

inputFormat

The first line contains an integer n specifying the number of commands. Each of the following n lines contains a command. There are three types of commands:

  • ADD;title;author;year;genre: Add a new book to the library. The fields are separated by a semicolon ';'.
  • SEARCH;author: Search for all books by the given author and print them.
  • LIST;start_year;end_year: List all books with publication years in the inclusive range [start_year, end_year].

For each SEARCH and LIST command, output the result on a new line. If there are no matching books, output No books found.

outputFormat

For every SEARCH and LIST command, print the result in the format <title> by <author> (<year>) - <genre> for each book, each on its own line. The outputs for different commands are printed sequentially in the order of the commands. If no books match the query, output No books found.

## sample
5
ADD;To Kill a Mockingbird;Harper Lee;1960;Fiction
ADD;1984;George Orwell;1949;Dystopian
SEARCH;George Orwell
LIST;1950;1965
SEARCH;J.K. Rowling
1984 by George Orwell (1949) - Dystopian

To Kill a Mockingbird by Harper Lee (1960) - Fiction No books found

</p>