#C10741. Find Missing Books
Find Missing Books
Find Missing Books
You are given a library system which contains n books. Each book is represented by a pair of values: an integer ID and a title. There is also a catalog consisting of m records, where each record is a book ID. Your task is to determine which books from the library are missing in the catalog.
More formally, let \(\mathcal{L}\) be the set of library books where each book is represented as \((ID, title)\) and let \(\mathcal{C}\) be the set of catalog book IDs. You need to find all books \((ID, title)\) such that \[ ID \notin \mathcal{C}. \]
The output should list the missing books in the same order as they appear in the library input. If no book is missing, print nothing.
inputFormat
The input is read from standard input (stdin) and has the following format:
- An integer \(n\) representing the number of books in the library.
- The following \(n\) lines each contain a book record. Each record consists of an integer ID and a string title (the title may contain spaces).
- An integer \(m\) representing the number of records in the catalog.
- If \(m > 0\), a line containing \(m\) space-separated integers representing the book IDs in the catalog.
outputFormat
Print to standard output (stdout) the missing books, each on a separate line. For each missing book, output its ID and title separated by a single space. The order of the output must be the same as the order of the library books in the input. If no books are missing, output nothing.
## sample4
1001 The Great Gatsby
1002 1984
1003 To Kill a Mockingbird
1004 The Catcher in the Rye
3
1001 1002 1004
1003 To Kill a Mockingbird