import re
stri = raw_input ()
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]))", stri)
LEQ={}

for i in ANS:
    if LEQ.has_key(i):
        LEQ[i]+=1
    else:
        LEQ[i] = 0

MAX = -1
for it in LEQ.iterkeys():
    if MAX < LEQ[it]:
        ans = i
        MAX = LEQ[i]

print ans