#C201. Archive Library Management

    ID: 45279 Type: Default 1000ms 256MiB

Archive Library Management

Archive Library Management

Problem Description: You are required to implement a library system that manages documents in an archive. Your program should support operations to add a document, retrieve document details by its identifier, list all documents, and search for documents by title.

For the ADD operation, insert a new document with attributes: title, author, year, document type, and content. Each added document is assigned a unique sequential identifier starting from 1.

For the GET operation, retrieve and display the details of the document with the given id. If no such document exists, output 'None'.

For the LIST operation, output the details of all documents in the order they were added. If no document exists, output 'None'.

For the SEARCH operation, output the details of all documents whose title contains the given keyword (case insensitive). If no matching documents are found, output 'None'.

The details should be printed in the following format: (title, author, year, document_type, content).

inputFormat

Input Format: The first line contains an integer (Q), the number of operations. Each subsequent operation is formatted as follows:

  1. ADD operation: ADD
  1. GET operation: GET

  2. LIST operation: LIST

  3. SEARCH operation: SEARCH

Each field is provided on a new line.

outputFormat

Output Format: For each operation, output the result as follows:

  • ADD: Print the document id assigned (an integer).
  • GET: If the document exists, print its details in one line in the format: (title, author, year, document_type, content). Otherwise, print 'None'.
  • LIST: Print the details of all documents in insertion order, each on a new line. If no document exists, print 'None'.
  • SEARCH: Print the details of all matching documents in insertion order, each on a new line. If no matching documents are found, print 'None'.## sample
4
ADD
Test Book
Author A
2023
book
Content of the book
GET
1
LIST
SEARCH
Test
1

Test Book, Author A, 2023, book, Content of the book Test Book, Author A, 2023, book, Content of the book Test Book, Author A, 2023, book, Content of the book

</p>