
s = raw_input()
x = s.split('-')

count = {}
days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

for i in range(2, len(x)):
    dd = x[i - 2][-2:]
    mm = x[i - 1]
    yyyy = x[i][:4]
    if len(yyyy) == 4 and 2013 <= int(yyyy) <= 2015:
        if len(dd) == 2 and len(mm) == 2:
            d = int(dd)
            m = int(mm)
            if 1 <= m <= 12 and 1 <= d <= days_in_month[m - 1]:
                key = '%s-%s-%s' % (dd, mm, yyyy)
                count[key] = count.get(key, 0) + 1

m = 0
for key, val in count.items():
    if val > m:
        val = m
        r = key

print r
