import datetime
def isValid(s):
    boolean =True
    try:
        datetime.datetime(int(s[2]),int(s[1]),int(s[0]))
        return True
    except ValueError:
        boolean = False
        return boolean    

str = input()
i = 0
def valid(s):
    try:
        k = s.split("-")
        
       
        if int(s[6:10]) and (int(k[0]) > 0 and int(k[0])<32) and (int(k[1]) > 0 and int(k[1]) <13) and (int(k[2]) > 2010 and int(k[2]) <2016):
            if isValid(k):
                return True
            else: return False
        else:
            return False    
    except ValueError:
        return False
result = []
while i+10<= len(str):
    if valid(str[i:i+10]) :
        result.append(str[i:i+10])
    i+=1 


res =  result[0:]

count = [0]*len(result)

for i in range(len(result)):
    if result[i] in res:
        count[result.index(result[i])] +=1
        res[i] = 0
    if res is None: break

if result: print(result[count.index(max(count))])        


