1014

day = {'A': 'MON', 'B': 'TUE', 'C': 'WED', 
       'D': 'THU', 'E': 'FRI', 'F': 'SAT', 'G': 'SUN'}
hour = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5,
        '6': 6, '7': 7, '8': 8, '9': 9, 'A': 10, 'B': 11,
        'C': 12, 'D': 13, 'E': 14, 'F': 15, 'G': 16, 'H': 17,
        'I': 18, 'J': 19, 'K': 20, 'L': 21, 'M': 22, 'N': 23,}
one = input()
two = input()
three = input()
four = input()
flag = True
i = 0
while i < min(len(one), len(two)):
    if one[i] == two[i] and ord(one[i]) >= 65:
        if flag:
            print(day[one[i]], end = ' ')
            flag = False
            i = i + 1
            continue
    if one[i] == two[i] and flag == False:
        print(hour[one[i]], end = '')
        break
    i = i + 1
i = 0
while i < min(len(three), len(four)):
    if three[i] == four[i] and ((ord(one[i]) >= 65 and ord(one[i]) <= 90) or 
                                 (ord(one[i]) >= 97 and ord(one[i]) <= 122)):
        if i <= 9:
            print(':0', end = '')
            print(i)
            exit(0)
        else:
            print(':', end = '')
            print(i)
            exit(0)
    i = i + 1
exit(0)
        
            
            
            

你可能感兴趣的:(PAT)