from collections import defaultdict
t = input()
s = defaultdict(int)
for i in range(len(t) - 9):
    if t[i + 2] == '-' and t[i + 5: i + 9] == '-201' and '2' < t[i + 9] < '6' and t[i: i + 2] > '00':
        if (t[i + 3] == '0' and '0' < t[i + 4] <= '9') or (t[i + 3] == '1' and '0' <= t[i + 4] < '3'):
            if t[i: i + 2] < '30': s[t[i: i + 10]] += 1
            elif t[i: i + 2] == '30': 
                if t[i + 3: i + 5] != '02': s[t[i: i + 10]] += 1
            elif t[i: i + 2] < '32' and not (t[i + 3: i + 5] in ['04', '06', '09', '11']): s[t[i: i + 10]] += 1
m = max(s.values())
for i in s:
    if s[i] == m:
        print(i)
        break