import sys, re, datetime

s = raw_input()

a = dict()

myre = re.compile(r'(?=((\d\d)-(\d\d)-(\d\d\d\d)))')
for mtch in myre.finditer(s):
    try:
        d, m, y = [int(x=mtch.group(i)) for i in [2, 3, 4]]
        if not 2013 <= y <= 2015:
            raise
        datetime.date(y, m, d)
        ds = mtch.group(1)
        if ds not in a:
            a[ds] = 1
        else:
            a[ds] += 1
    except:
        pass

print max(a.iteritems(), key = lambda x: x[1])[0]