import sys
from datetime import datetime
line = raw_input()
alldate = dict()
for i in xrange(0,len(line) - 9):
    sub = line[i:i + 10]
    try:
        dt = datetime.strptime(sub,"%d-%m-%Y")
        if dt.year >= 2013 and dt.year <=2015:
            if dt in alldate:
                alldate[dt] = alldate[dt] + 1
            else:
                alldate[dt] = 1
    except:
        1

    

ans = None
for dt in alldate.keys():
    if ans == None or alldate[dt] > alldate[ans]: ans = dt
print "%d%d-%d%d-%d" % (ans.day/10,ans.day%10,ans.month/10,ans.month%10,ans.year)
