#C26. Library Book Availability Checker
Library Book Availability Checker
Library Book Availability Checker
You are given a list of book titles available in a library and a list of requested book titles. Your task is to determine for each requested book whether it is available in the library or not.
For each requested book, if the book is present in the library, output Available
; otherwise, output Not Available
.
The problem tests your ability to efficiently check membership in a collection. The solution can be implemented by converting the library list into a set (or any efficient lookup data structure) for faster access.
Note: All input is read from stdin
and all output should be written to stdout
.
inputFormat
The input is given in the following format:
- The first line contains an integer n representing the number of library books.
- The next n lines each contain a string, the title of a library book.
- The following line contains an integer m representing the number of requested books.
- The next m lines each contain a string, the title of a requested book.
outputFormat
Output consists of m lines. For each requested book, print Available
if the book is in the library's collection, otherwise print Not Available
.
5
Introduction to Algorithms
Clean Code
Design Patterns
The Pragmatic Programmer
Artificial Intelligence
3
Clean Code
Effective Java
Introduction to Algorithms
Available
Not Available
Available
</p>