prop = raw_input().split('-')
from calendar import monthrange
allowed_years = ['2013','2014','2015']
allowed_months = ['01','02','03','04','05','06','07','08','09','10','11','12']
from collections import Counter
date_counter = Counter()
allowed_dates = {'2013': {}, '2014': {}, '2015': {}}
for y in allowed_dates.keys():
    months = {}
    for i in range(1,13):
        months[i] = str(monthrange(int(y), i)[1])
    allowed_dates[y] = months
for i in xrange(len(prop)):
    if len(prop[i]) == 2 and prop[i] in allowed_months:
        if i-1 >= 0 and i+1 < len(prop):
            if len(prop[i-1]) >= 2 and len(prop[i+1]) >= 4:
                if prop[i+1][:4] in allowed_years and prop[i-1][-2:] >= '01' and prop[i-1][-2:] <= allowed_dates[prop[i+1][:4]][int(prop[i])]:
                    d = prop[i-1][-2:] + '-' + prop[i] + '-' + prop[i+1][:4]
                    date_counter[d] += 1
print date_counter.most_common(1)[0][0]