#K44672. Calculate Work Hours

    ID: 27584 Type: Default 1000ms 256MiB

Calculate Work Hours

Calculate Work Hours

Given the number of employees and, for each employee, several work periods with start and end times in HH:MM format, your task is to calculate the total number of hours each employee has worked. For every work period, compute the time difference by converting the start and end times into minutes, then summing these values and finally converting back into the HH:MM format.

The result for each employee should be output on a separate line. All inputs are provided via standard input (stdin) and output should be printed to standard output (stdout), making this problem suitable for a programming contest setting.

inputFormat

The input begins with an integer \(n\) representing the number of employees. For each employee, the following input is provided:

  • An integer \(m\) indicating the number of work periods.
  • Then, \(m\) lines follow; each line contains two time strings in 24-hour format (HH:MM), separated by a space, representing the start and end times of a work period.

Example:

2
3
08:00 12:00
13:00 17:00
18:00 20:00
2
09:00 11:00
12:00 15:00

outputFormat

For each employee, output a single line containing the total work time in the format HH:MM.

Example output for the above input:

10:00
05:00
## sample
2
3
08:00 12:00
13:00 17:00
18:00 20:00
2
09:00 11:00
12:00 15:00
10:00

05:00

</p>