#K79597. Count Valid Library Extension Requests
Count Valid Library Extension Requests
Count Valid Library Extension Requests
You are given a list of library borrowing records. Each record consists of four fields: User name, Book name, Borrow date and Extension request date. The library allows a user to request an extension of the borrowing period only if the request is made after the halfway point and before the due date.
The borrowing period is fixed as \( T = 14 \) days. The halfway point is at \( T/2 = 7 \) days. In other words, if the borrowing date is \( d \), then the extension request date \( e \) is valid if and only if
[ \text{borrow date} + 7 < e < \text{borrow date} + 14. ]
Your task is to count how many extension requests among the given records are valid according to the above policy.
inputFormat
The input is read from standard input. The first line contains an integer \( n \) representing the number of borrowing records. Each of the following \( n \) lines contains a record with 4 fields separated by a semicolon (;
):
- User name
- Book name (can contain spaces)
- Borrow date in the format
YYYY-MM-DD
- Extension request date in the format
YYYY-MM-DD
For example: Alice;Pride and Prejudice;2023-01-01;2023-01-10
outputFormat
Output a single integer to the standard output, which is the number of valid extension requests.
## sample1
Alice;Pride and Prejudice;2023-01-01;2023-01-10
1
</p>