s=input()
d={}
for i in range(0,len(s)-1):
    a=s[i:i+10]
   # print(a,a[6:10]>='2013', a[6:10]<='2015',a[3:5]>='01',a[3:5]<='12',a[0:2]>='01',a[0:2]<='31')
    if a in d:
        d[a]+=1
    else:
        if a[6:10]>='2013' and a[6:10]<='2015' and a[3:5]>='01' and a[3:5]<='12' and a[0:2]>='01' and a[0:2]<='31':
            if int(a[3:5])==2 and a[0:2]>'29':
                continue
            elif int(a[3:5])%2==0 and a[0:2]>'30':
                continue
            else:
                d[a]=1
m=0
#print(d)
for i in d:
    if d[i]>m:
        m=d[i]
        k=i
print(k)
