import sys, re

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

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)-10):
    if s[i+2] == s[i+5] == '-':
        d = s[i:i+10]
        if r.match(d):
            if d in cn:
                cn[d] += 1
            else:
                cn[d] = 0

try:
    mx = max(cn.values())
    for k, v in cn.iteritems():
        if v == mx:
            sys.stdout.write(k)
            break
except:
    sys.stdout.write('00-00-0000')
