#K57437. Library System Management
Library System Management
Library System Management
You are tasked with implementing a simple library system. In this system, you can add a book, delete a book, or find a book. The commands are given in sequential order. For each 'Add' operation, add a book with its author. If a duplicate title is added, update the author. For a 'Delete' operation, remove the book record if it exists. For a 'Find' operation, output the author if the book is present, otherwise output "Not found".
The input begins with an integer indicating the number of operations, followed by that many lines describing each operation.
Note: The operations are case-sensitive. Ensure your solution handles case variations appropriately.
inputFormat
The first line of input contains an integer n, denoting the number of operations. Each of the following n lines contains an operation in one of the following formats:
- Add
- Delete
- Find
For the Add command, the system will add a book with the provided title and author. If a duplicate title is added, the author is updated. For Delete, the book record (if exists) is removed. For Find, the system outputs the author if the book exists, otherwise outputs "Not found".
outputFormat
For every 'Find' operation, output the result on a new line. The result is either the author's name or "Not found" if the book does not exist in the system.## sample
6
Add HarryPotter JKRowling
Add TheHobbit JRRRTolkien
Find HarryPotter
Find TheLordOfTheRings
Delete HarryPotter
Find HarryPotter
JKRowling
Not found
Not found
</p>