Problem C
Clock Catchup
Oh no! The clocks in Marquez Hall froze at the start of a power outage, which has now been remedied. The repair crew needs your help figuring out how to restore the current time.
Each analog clock has three arms: seconds, minutes, and hours. Given the time of the power outage and the time the power was restored (the current time), how many times does each arm of the clock have to move onto the $12$ to get to current time from the time where the clock froze due to the power outage?
Note: we are explicitly asking for how many times the arm moves onto the $12$. If the arm starts at $12$ and moves off of it, that does not count as moving onto the $12$.
If you’re unfamiliar with analog clocks, check out this interactive site: https://toytheater.com/clock/.
Input
The input will consist of two newline-separated $24$-hour time strings representing the start of the power outage, and the current time (the time at which the power was restored), respectively.
Both times are in the format HH:MM:SS where HH is the hour, MM is the minute, and SS is the second. All times are guaranteed to be valid, and leading zeros will be present for single-digit hours, minutes, and seconds.
You are guaranteed that the hour will be in the range $[00, 23]$, the minute will be in the range $[00, 59]$, and the second will be in the range [$00, 59$].
Note that the minimum valid time is 00:00:00, and the maximum valid time is 23:59:59. The first time (the time of the power outage) is guaranteed to be before the second time (the time of power restoration). Both times are guaranteed to be within the same calendar day.
Output
Output three space-separated integers on a single line, representing how many times the hour arm, minute arm, and second arm moves onto the $12$, respectively, to get to the current time from the time where the clock froze due to the power outage.
Sample Input 1 | Sample Output 1 |
---|---|
01:00:01 01:01:35 |
0 0 1 |
Sample Input 2 | Sample Output 2 |
---|---|
06:00:59 13:50:01 |
1 7 470 |
Sample Input 3 | Sample Output 3 |
---|---|
12:59:58 13:00:01 |
0 1 1 |
Sample Input 4 | Sample Output 4 |
---|---|
12:00:00 12:00:01 |
0 0 0 |
Sample Input 5 | Sample Output 5 |
---|---|
11:59:59 12:01:01 |
1 1 2 |
Sample Input 6 | Sample Output 6 |
---|---|
11:59:59 12:00:00 |
1 1 1 |