#C13849. Library System Simulation

    ID: 43432 Type: Default 1000ms 256MiB

Library System Simulation

Library System Simulation

This problem asks you to simulate a simple library system. The system supports several operations: adding a book, updating its quantity, borrowing a book, returning a book, and searching for books by a search term. For a SEARCH operation, you must print all matching books in the order they were added. A book matches if the search term is a substring of its title or author (case‐insensitive).

For each matching book, output its details in the following format:

\( title,author,quantity \)

If no books match, output a single line containing None.

inputFormat

The first line contains an integer n representing the number of commands.

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

  • ADD book_id title author quantity
  • UPDATE book_id quantity
  • BORROW book_id
  • RETURN book_id
  • SEARCH term

Note: The title and author are given as single-word strings (words may contain underscores instead of spaces).

outputFormat

For each SEARCH command, output the matching books in the order they were added. For each matching book, print its title, author, and quantity separated by commas on a single line.

If no books match the search, print a single line with None.

All output should be produced to STDOUT.

## sample
8
ADD 1 The_Great_Gatsby F._Scott_Fitzgerald 3
ADD 2 1984 George_Orwell 5
ADD 3 To_Kill_a_Mockingbird Harper_Lee 2
BORROW 1
RETURN 1
UPDATE 1 4
SEARCH 1984
SEARCH F._Scott_Fitzgerald
1984,George_Orwell,5

The_Great_Gatsby,F._Scott_Fitzgerald,4

</p>