28 lines
588 B
Python
28 lines
588 B
Python
|
import io
|
||
|
import sys
|
||
|
|
||
|
sys.stdin = io.StringIO('''18:0?
|
||
|
2?:1?''') # 121 319
|
||
|
|
||
|
|
||
|
def check(tStr, tInt):
|
||
|
s = '%02d' % (tInt / 60) + ':' + '%02d' % (tInt % 60)
|
||
|
for x in range(len(s)):
|
||
|
if tStr[x] != '?' and tStr[x] != s[x]:
|
||
|
return False
|
||
|
|
||
|
return True
|
||
|
|
||
|
|
||
|
tStr1 = input()
|
||
|
tStr2 = input()
|
||
|
minT, maxT = 9999, 0
|
||
|
for i in range(0, 24 * 60):
|
||
|
if check(tStr1, i):
|
||
|
for j in range(i + 1, 24 * 60):
|
||
|
if check(tStr2, j):
|
||
|
minT = j - i if 0 < j - i < minT else minT
|
||
|
maxT = j - i if maxT < j - i else maxT
|
||
|
|
||
|
print(minT, maxT)
|