string = raw_input()

data = string.split("-")
leap = [1,3,5,7,8,10,12]
count = {}

for i in range(len(data) - 2):
    if data[i] == '' or data[i+1] == '' or data[i+2] == '':
        continue
    dd = int(data[i]) % 100
    mm = int(data[i+1]) % 100
    yy = int(data[i+2][0:4])
    if mm > 12 or yy > 2015 or yy < 2013 or mm < 1 or dd < 1 or dd > 31:
        continue
    if dd < 29 or (dd == 31 and mm in leap) or (dd < 31 and mm != 2):
        if not count.has_key(str(dd) + "-" + str(mm) + "-" + str(yy)):
            count[str(dd) + "-" + str(mm) + "-" + str(yy)] = 1
        else:
            count[str(dd) + "-" + str(mm) + "-" + str(yy)] += 1
    dd %= 10
    if not count.has_key(str(dd) + "-" + str(mm) + "-" + str(yy)):
        count[str(dd) + "-" + str(mm) + "-" + str(yy)] = 1
    else:
        count[str(dd) + "-" + str(mm) + "-" + str(yy)] += 1

maxvalue = 0
maxkey = ""
for key in count.keys():
    if maxvalue < count[key]:
        maxvalue = count[key]
        maxkey = key
print maxkey
