import sys, re

s = sys.stdin.read().strip()

M = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

cn = {}
#r = re.compile('^((0[1-9]|1[0-9]|2[0-8])-(0[1-9]|1[0-2])|(29|30)-01|(29|30)-0[3-9]|(29|30)-1[0-2]|31-0[13578]|31-1[02])-201[345]$')
for i in range(0, len(s)-9):
    if s[i+2] == s[i+5] == '-':
        d = s[i:i+10]
        try:
            day = int(d[0:2])
            month = int(d[3:5])
            year = int(d[6:10])
            if 1 <= month <= 12:
                if 1 <= day <= M[month]:
                    if 2013 <= year <= 2015:
                        if d in cn:
                            cn[d] += 1
                        else:
                            cn[d] = 1
        except:
            pass

mx = max(cn.values())
for k, v in cn.iteritems():
    if v == mx:
        sys.stdout.write(k)
        break
