PROBLEM 7 : TIME CLOCK
You need to compute the total time a worker has worked
on a single calendar day given two timestamps of the form “HH:MM”. The numbers
MM can be in the range of “00” to “59” while HH is in the range “01” through
“12”. This is an archaic (old-fashioned) timestamp clock that doesn’t even
record AM or PM values. The system has worked well in the past because no-one has
ever worked longer than an 8 hour shift.
You can be assured that the two times are different
and represent an employee checking in to work (on a calendar day) and checking
out from work later on the exact same calendar day. You are to output the total
time as “HH:MM”. If the accumulated work time is greater than 8 hours (in other
words, 481 minutes or longer), then you are ordered to output “08:00” because
this is the maximum time that the employee would be paid.
Input
The first line of the input contains an integer N (1 ≤ N
≤ 30), the number of test cases. The following line will contain pairs of
timestamps representing the starting and ending time containing five characters
of the form “HH:MM” where HH is in the range “01” and “12” while MM in the range
“00” through “59”.
The input must be read from standard input.
Output
The
output of the program should display the accumulated time as “HH:MM” on a
single line by itself where HH represents the number of hours in the range “00”
to “12” and MM represents the number of minutes in the range “00” and “59”.
The
output must be written to standard output.
Sample
Input
|
Sample
Output
|
4
09:13 04:42
09:12 10:03
03:10 11:15
07:13 01:01
|
07:29
00:51
08:00
05:48
|
Problem Setter : Mohd Nizam Osman