def isInteger(k):
    try:
        n = int(k[5:10])
        return True
    except ValueError:
        return False   
str = input()
k = ""
arr = []
for i in str:
    if i != "-":
        k += i
    else: 
        arr.append(k)
        k= ""
s = ""
print(arr)

for i in arr:
    
    if i != "" and len(i) != 3:
        s += i+"-"
    elif len(s) != 0:
        
        str_arr=s
        s = ""
        
check_up = [30,12,2015]
check_down = [1,1,2013]

k =10
t =0
result = []
p = 0
for i in str_arr:
    n = str_arr[t:k]
    k +=1
    t +=1
    if len(n) == 10 and isInteger(n) == True :
        boolean = True
        for i in n.split("-"):
            
            if (int(i) >= check_down[p] and int(i)<= check_up[p]):
                boolean = True
            else: booleean = False
            p+=1 
        p = 0       
        if boolean == True:
            result.append(n)    
print(result)
new = result 

q =0
for i in result:
    r =0
    for t in result:
        if i == t:
            r +=1
    if r > q:
        q = r
        lastly = result.index(i)





print(result[lastly]) 