import operator
from datetime import datetime
s = raw_input()
count = {}
for i in xrange(len(s) - len("dd-mm-yyyy")+1):
    key = s[i:(i+10)]
    if key in count:
        count[key] += 1
    else:
        count[key] = 1
for key,value in sorted(count.items(), key=lambda x: -x[1]):
        try:
            temp = key.split("-")
            if len(temp) == 3 and len(temp[0]) == 2 and len(temp[1]) == 2 and len(temp[2]) == 4:
                temp = map(int, temp)
                d = datetime(temp[2], temp[1], temp[0])
                print key
                break
        except ValueError:
            continue
        
            
            