#K58542. Total Hours Worked
Total Hours Worked
Total Hours Worked
You are given a list of work log entries. Each log entry records a work shift on a specific day in the following format:
YYYY-MM-DD hh:mm-hh:mm
Your task is to calculate the total number of hours worked by summing the duration of each shift.
For each log entry, the duration is computed as:
$$\text{Duration} = \text{end\_time} - \text{start\_time}$$
Note: You can assume that every log entry has valid times with the end time always equal to or later than the start time, and all shifts occur on the same day as indicated.
If there are no log entries, the total number of hours worked is 0.
inputFormat
The first line contains an integer N, representing the number of log entries. Each of the following N lines contains a work log entry in the format: "YYYY-MM-DD hh:mm-hh:mm".
outputFormat
Output a single integer representing the total number of hours worked.## sample
1
2023-09-01 09:00-17:00
8