import re
s = raw_input()
g = []
for t in re.findall('(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[012])-(201[345])', s):
    d = '-'.join(t)
    sd = len([m.start() for m in re.finditer('(?='+d+')', s)])
    g.append([d, sd])
print sorted(g)[0][0]