import re
table = [None,31,28,31,30,31,30,31,31,30,31,30,31]
cand = {i:{j:{k:0 for k in range(1,32)} for j in range(1,13)} for i in [2013, 2014, 2015]}
mx = [2013, 1, 1, 0]
inp = raw_input()
length = len(inp)
for i in xrange(length-9):
    cut_str = inp[i:i+10]
    g = re.findall("(\d\d)-(\d\d)-(2013|2014|2015)", cut_str)
    if len(g) == 0:
        continue
    g = g[0]
    month = int(g[1])
    if (1 <= month and month <= 12):
        day = int(g[0])
        if (1 <= day and day <= table[month]):
            year = int(g[2])
            tmp = cand[year][month][day] + 1
            cand[year][month][day] = tmp
            if tmp > mx[3]:
                mx = [year, month, day, tmp] 
print "%02d-%02d-%d" % (mx[2],mx[1],mx[0])
