#! /usr/bin/env python2

import datetime

s = raw_input().strip()

record = {}

for i in xrange(len(s) - 9):
    ss = s[i:i+10]
    if ss[2] == '-' and ss[5] == '-':
        sss = ss.split('-')
        if len(sss) == 3:
            if len(sss[0]) == len(sss[1]) == 2:
                if len(sss[2]) == 4:
                    d, m, y = map(int, sss)
                    if 2013 <= y <= 2015:
                        try:
                            datetime.date(y, m, d)
                            record.setdefault(ss, 0)
                            record[ss] += 1
                        except:
                            pass

m = max(record.values())
for k in record.keys():
    if record[k] == m:
        print k
        break
