import re
import datetime

inp = raw_input()
matches = re.finditer(r'(?=(\d\d-\d\d-\d\d\d\d))', inp)
results = [ match.group(1) for match in matches]
dic = {}

for date in results:
    try:
        temp = datetime.datetime.strptime(date, "%d-%m-%Y")
        if temp.year >= 2013 and temp.year <= 2015:
            try:
                dic[date] += 1
            except KeyError:
                dic[date] = 1
    except Exception, exception:
        pass

ans_val = -1
ans = ""
for key, value in dic.iteritems():
    if value > ans_val:
        ans_val = value
        ans = key
print ans
