#C705. Library Catalog Management
Library Catalog Management
Library Catalog Management
You are tasked with managing a library catalog by processing a series of queries.
There are three types of queries:
- 1 ID title author: Add a new book with the specified ID, title, and author. If a book with the same ID already exists, it should be replaced by the new information.
- 2 ID: Retrieve and print the details of the book with the given ID in the format:
Title: [title], Author: [author]
. If the book is not found, outputBook not found
. - 3 ID: Remove the book with the given ID from the catalog.
Each query is provided on a separate line. The output should be produced only for queries of type 2, in the same order as the queries appear.
Input Format:
The first line contains an integer n (where \(n \ge 1\)) denoting the number of queries. The following n lines each contain a query in one of the three formats described above.
Output Format:
For each query of type 2, output a single line with the information of the book in the format shown above or output Book not found
if the book does not exist.
Note: All queries are processed sequentially, and the state of the catalog updates accordingly.
inputFormat
The input begins with an integer n on the first line, indicating the number of queries. Each of the following n lines contains a query in one of the following formats:
1 ID title author
2 ID
3 ID
Here, ID is an integer and title and author are strings (without spaces). The queries are provided in stdin.
outputFormat
For each query of type 2, output the book details as a single line to stdout in the format:
Title: [title], Author: [author]
If the book is not present in the catalog, output:
Book not found
Outputs must appear in the same order as the queries.
## sample2
1 101 The_Great_Gatsby F._Scott_Fitzgerald
2 101
Title: The_Great_Gatsby, Author: F._Scott_Fitzgerald