import sys
import re
from datetime import datetime
from collections import Counter

def calc(s):
    cnt = Counter()
    for word in re.finditer(r'(?=(\d{2}-\d{2}-\d{4}))', s):
        try:
            d = datetime.strptime(word.group(1), '%d-%m-%Y')
            if datetime(2013, 1, 1) <= d and d <= datetime(2015, 12, 31):
                cnt[d] += 1
        except ValueError:
            pass
    m, _ = cnt.most_common(1)[0]
    return m.strftime('%d-%m-%Y')
    
def solve(lines, output):
    s = lines.readline().strip()
    output.write('{0}\n'.format(calc(s)))

if __name__ == '__main__':
    solve(sys.stdin, sys.stdout)
