from collections import deque
from math import log,sqrt,ceil
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())
s=si()
a=[]
s1=""
mon=[0,31,28,31,30,31,30,31,31,30,31,30,31]
for i in range(len(s)):
    if(s[i]=='-'):
        if(s1!=""):
            if(len(s1)==1):
                a.append(int(s1))
            elif(len(s1)>=4):
                a.append(int(s1[:4]))
                a.append(int(s1[-2:]))
            else:
                a.append(int(s1[-2:]))
            s1=""
    else:
        s1+=s[i]
if(len(s1)==1):
    a.append(int(s1))
elif(len(s1)>=4):
    a.append(int(s1[:4]))
    a.append(int(s1[-2:]))
else:
    a.append(int(s1[-2:]))
m={}
for i in range(len(a)):
    if(a[i]>=2013 and a[i]<=2015):
        x,y=0,0
        if(i-1>=0):
            x=a[i-1]
        if(i-2>=0):
            y=a[i-2]
        if(x>=1 and x<=12):
            if(y>0 and y<=mon[x]):
                tup=(y,x,a[i])
                if tup not in m:
                    m[tup]=1
                else:
                    m[tup]+=1
x=0
for i in m.keys():
    if(m[i]>x):
        x=m[i]
        y=i
dd=y[0]
if(dd<10):
    dd='0'+str(dd)
mm=y[1]
if(mm<10):
    mm='0'+str(mm)
yy=y[2]
s=str(dd)+'-'+str(mm)+'-'+str(yy)
print(s)


