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)
    if not g.has_key(d):
        g[d] = 1
    else:
        g[d] += 1
print sorted([i for i in g.iteritems()], key=lambda x: x[1], reverse=True)[0][0]
