import re
r=range
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 set(ANS):
    a,b,c = i.split ("-");
    if (int(c) not in r(2013,2016) or int(b) not in r(1, 13) or int(a) not in r(1, tveebi[int(b)]+1)): continue
    cc=ANS.count(i)
    if MAX < cc:
        ans = i
        MAX = cc

print ans