#C8794. Library Management System

    ID: 52815 Type: Default 1000ms 256MiB

Library Management System

Library Management System

You are required to implement a simple library management system. The system maintains a collection of books, each with a title, an author, and a publication year. You must implement the following functionalities in the Library class:

  • add: Add a new book with the given title, author, and year.
  • remove: Remove a book by its title. If the book exists, remove it and return True; otherwise, return False.
  • find_author: Given an author's name, return a list of all book titles written by that author. If none exist, return None.
  • find_year_range: Given a start and end year, return a list of all book titles published in the inclusive range. If no book is found, return None.

Note: The operations remove, find_author and find_year_range should immediately print their output to stdout.

All input is provided via stdin and all output should be printed to stdout. Use LaTeX format for any mathematical formulas (if used). For example, the condition for a book to be in the range can be represented as $start\_year \leq year \leq end\_year$.

inputFormat

The input begins with a single integer T indicating the number of commands.

Each of the next T lines contains a command in one of the following formats:

  • add title author year — Add a book with the given title (string), author (string), and year (integer).
  • remove title — Remove a book with the given title and print True or False as described.
  • find_author author — Find and print all titles by the given author. Titles must be output as a comma-separated list in the order they were added. If no book is found, output None.
  • find_year_range start_year end_year — Find and print all titles published between start_year and end_year (inclusive) as a comma-separated list. If none, output None.

outputFormat

For each command that requires an output (remove, find_author, and find_year_range), print the result on a new line.

- For remove, print either True or False (without quotes).

- For find_author and find_year_range, print a comma-separated list of book titles. If none, print None.

## sample
6
add Book1 Author1 2000
add Book3 Author1 2010
find_author Author1
remove Book1
remove Book1
find_year_range 1990 2005
Book1,Book3

True False None

</p>