m, n = input().split(':')
a, b = int(m), int(n)
c = 0
while True:
if a<10 and b>=10:
s = '0' + str(a) + str(b)
elif a>=10 and b<10:
s = str(a) + '0' + str(b)
elif a<10 and b<10:
s = '0' + str(a) + '0' + str(b)
else:
s = str(a) + str(b)
if s == s[::-1]:
break
else:
if a == 23 and b == 59:
a = 0
b = 0
c += 1
elif b == 59:
a += 1
b = 0
c += 1
else:
b += 1
c += 1
print(c)
#include <bits/stdc++.h>
using namespace std;
int b1,b2,c1,c2;
string s;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> s;
b1 = (s[0]-'0')*10+(s[1]-'0');
b2 = (s[3]-'0')*10+(s[4]-'0');
c1 = b1*60+b2;
if((b1==5 && b2>50) || (b1>5 && b1<10))
{
c2 = 601;
}
else
{
if((b1==15 && b2>51) || (b1>15 && b1<20))
{
c2 = 1202;
}
else
{
if(b2<=(b1%10)*10+b1/10)
{
c2 = b1*60+(b1%10)*10+b1/10;
}
else
{
if(b1==23)
{
c2 = 0;
}
else
{
b1++;
c2 = b1*60 + (b1%10)*10+b1/10;
}
}
}
}
cout << (1440+c2-c1)%1440 <<endl;
return 0;
}
1472B - Fair Division | 1281C - Cut and Paste |
141A - Amusing Joke | 112A - Petya and Strings |
677A - Vanya and Fence | 1621A - Stable Arrangement of Rooks |
472A - Design Tutorial Learn from Math | 1368A - C+= |
450A - Jzzhu and Children | 546A - Soldier and Bananas |
32B - Borze | 1651B - Prove Him Wrong |
381A - Sereja and Dima | 41A - Translation |
1559A - Mocha and Math | 832A - Sasha and Sticks |
292B - Network Topology | 1339A - Filling Diamonds |
910A - The Way to Home | 617A - Elephant |
48A - Rock-paper-scissors | 294A - Shaass and Oskols |
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |