s = input()

def is_Date_Correct(s):
    return  (1<=int(s[:2])<=30 and 1<=int(s[3:5])<=12 and 2013<=int(s[6:])<=2015)

def is_dateformat(s):
    if s[2]=='-' and s[5]=='-':
        for i in range(len(s)):
            if i==2 or i==5: continue
            if s[i] == '-':
                return False;
        return True;
    return False;

i = 0
map = {}
while(i<len(s)-10):
    x = s[i:i+10]
    if is_dateformat(x) and is_Date_Correct(x):
        if x in map:
            map[x]+=1
        else:
            map[x]=1
        i+=8
    else: 
        i+=1

count = 0
res = ""
for i in map:
    if map[i] > count:
        res = i 

print(res)
