string = raw_input()
year = ['-2015', '-2014', '-2013']
d = ['32', '29', '32', '31', '32', '31', '32', '32', '31', '32', '31', '32']
mp = {}
flag = False
for y in year:
    tmp = string
    p = tmp.find(y)
    while p != -1:
        if cmp(tmp[p - 3], '-') == 0:
            month = tmp[p - 2:p]
            day = tmp[p - 5: p - 3]
            if month.isdigit() and day.isdigit():
                if cmp(month, '00') > 0 and cmp(month, '13') < 0:
                    if cmp(day, '00') > 0 and cmp(day, d[int(month) - 1]) < 0:
                        s = day + '-' + month + y[0:5]
                        if mp.has_key(s):
                            mp[s] += 1
                        else:
                            mp[s] = 1
        tmp = tmp[p + 3:]
        p = tmp.find(str(y))
m = 0
for key in mp:
    if mp[key] > m:
        m = mp[key]
        ans = key
print ans
