#K33287. Minimum Timer Adjustments
Minimum Timer Adjustments
Minimum Timer Adjustments
Your task is to determine the minimum number of adjustments required to reset a timer from its current time to a given correct time. The timer displays time in the format hh:mm. You can adjust the timer by independently setting the hours or the minutes.
Formally, let the current time be \(H_1:M_1\) and the correct time be \(H_2:M_2\). The number of adjustments needed is:
\[ \text{adjustments} = \begin{cases} 0, & \text{if } H_1 = H_2 \text{ and } M_1 = M_2,\\ 1, & \text{if } H_1 \neq H_2 \text{ or } M_1 \neq M_2 \text{ (but not both)},\\ 2, & \text{if } H_1 \neq H_2 \text{ and } M_1 \neq M_2. \end{cases} \]Read the current and correct time from standard input and output the minimal number of adjustments as an integer.
inputFormat
The input consists of two lines:
- The first line contains the current time in hh:mm format.
- The second line contains the correct time in hh:mm format.
outputFormat
Output a single integer which is the minimum number of adjustments needed.
## sample13:45
13:45
0
</p>