T
T
TechnoSas2020-06-03 19:12:31
Python
TechnoSas, 2020-06-03 19:12:31

How to solve the problem List of books for the summer?

This summer, the local library suddenly ran into a flood of schoolchildren wanting to borrow some books from the bibliography. In order not to burden their employees, the library management decided to create an electronic book accounting system that would show which books are available. The library was audited and recorded in the system all the books. When another student tries to borrow a book, the librarian first checks to see if it is available. If there is, the book is temporarily removed from the system. The student has one month to return the book. You have been assigned to write this system and test it on a set of simulated records. We will assume that if the student has not returned the book within a month, the collectors hired by the head of the library, on the day of the expiration of the term, independently withdraw the book.

Input format: first, a list of books separated by commas is passed to the program, then strings describing the behavior of visitors: a string like "Take <book> <date> (<name>)" or "Return <book> <date>". Input occurs up to a point. Please note that the library management decided to make things more difficult for you, and the records are not transferred in chronological order.

Output format: after the visitor took the book, you need to print "The book <book> took (a) <name>". If this book does not exist, print "The book <book> is missing. It was taken by <name>".

Note: if a student took a book on the k-th day of the n-th month, then it is guaranteed that the k-th day of the (n + 1)-th month is a valid date.

Sample Input:

"Eden", "
2019 Take "Solaris" 07/19/2019 (Karl) Take "It" 08/22/2019 (Jane) . sample output:

The Solaris book was taken by Carl
The It book was taken by Simon
The It book is missing. She was taken by Simon
The book "Night Watch" was taken by Dmitry
The book "Solaris" was taken by Simon
The book "Solaris" is missing. It was taken by Simon
The book "I have the honor" was taken by Carl
The book "It" was taken by Jane
The book "Night Watch" was taken by Sergey
The book "War and Peace" was taken by Natasha
The book "Eden" taken by Natasha
The book "War and Peace" was taken by Sergey
The book "Eden" is missing. She was taken by Natasha

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question