#K54692. Book Borrowing Status Checker
Book Borrowing Status Checker
Book Borrowing Status Checker
You are given a list of book titles that have been borrowed from a library and a title of a book that you want to check. Your task is to determine if the given book is currently borrowed. If the book is in the list of borrowed books, print Borrowed
; otherwise, print Available
.
Note: The input is provided via standard input and the output must be printed to standard output. Use the appropriate methods to read from stdin and write to stdout.
Input Format: The first line contains an integer n indicating the number of borrowed books. The following n lines list the titles of the borrowed books (each may contain spaces). The last line contains the title of the book to check.
Output Format: A single line containing either Borrowed
if the book is found, or Available
otherwise.
The problem can also be stated mathematically as follows:
If we let B = {b1, b2, ..., bn} denote the set of borrowed books and c denote the book to check, then we need to determine if c \in B. If true, output Borrowed; otherwise, output Available.
inputFormat
The input is read from standard input (stdin) and is structured as follows:
- The first line contains an integer n (1 ≤ n ≤ 1000), representing the number of borrowed books.
- The next n lines each contain a borrowed book title (which may include spaces).
- The last line contains a single book title check_book that you need to check.
outputFormat
Output a single line to the standard output (stdout) which is either Borrowed
if the given book is in the list, or Available
if it is not.
4
Moby Dick
Pride and Prejudice
The Great Gatsby
War and Peace
War and Peace
Borrowed