~/algor $ cat problems/palindrom-vaqt
Palindrome time
Medium
1000 ms
256 MB
45%
A digital clock shows the time in the $24$-hour format HH:MM. A time is a palindrome if its four digits without the colon (HHMM) read the same left to right and right to left (for example, 05:50, 12:21, 00:00; 12:12 is not a palindrome). The current time is given. Find how many minutes you have to wait until the nearest palindrome time; 00:00 follows 23:59. If the current time is a palindrome itself, the answer is $0$.
Input
One line with the current time in the format HH:MM (two-digit hours and minutes).
Output
One integer — the number of minutes to wait.
Note
$00 \le HH \le 23$
$00 \le MM \le 59$
Examples
Input #1
12:21
Output #1
0
Input #2
23:59
Output #2
1