import re

tveebi = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
ANS = re.findall("(?=([0-9][0-9]-[0-9][0-9]-201[345]))", raw_input ())
LEQ={}
MAX = -1
ans=""

for i in ANS:
    a,b,c = i.split ("-");
    if (int(c) not in range(2013,2016) or int(b) not in range (1, 13) or int(a) not in range(1, tveebi[int(b)]+1)): continue
    if LEQ.has_key(i):
        LEQ[i]+=1
    else:
        LEQ[i] = 0
    if MAX < LEQ[i]:
        ans = i
        MAX = LEQ[i]

print ans