#K84092. Overdue Books Checker
Overdue Books Checker
Overdue Books Checker
You are given a list of borrowed books. Each book record contains a unique book ID, the book title, the borrow date, the due date, and the returned date in the format YYYY-MM-DD
.
Your task is to determine which books were returned overdue. A book is considered overdue if the returned date is strictly later than the due date. If at least one book is overdue, output the overdue book IDs in increasing order, separated by a single space. If no book is overdue, output No Overdue Books
.
Note: All dates are guaranteed to have the format YYYY-MM-DD
, and you can compare them using proper date comparison methods or by leveraging lexicographical order.
inputFormat
The first line contains an integer n — the number of books.
Each of the following n lines contains 5 space-separated items: book_id
(an integer), title
(a string without spaces), borrow_date
, due_date
, and returned_date
(all in the format YYYY-MM-DD
).
outputFormat
If there is at least one overdue book, print the overdue book IDs in increasing order separated by a single space. Otherwise, print No Overdue Books
.
3
1 WarAndPeace 2015-05-01 2015-05-15 2015-05-16
2 MobyDick 2015-07-20 2015-08-10 2015-08-09
3 TheHobbit 2019-03-05 2019-03-20 2019-03-25
1 3