#!/usr/bin/python2.7
import re
def validDate(x,y,z):
    if y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12 :
        if x>=1 and x<=31:
            return True;
        return False
    if y == 2:
        if x >=1 and x<=28:
            return True
        return False
    if y==4 or y==6 or y==9 or y==11:
        if x>=1 and x<=30:
            return True
        return False
a=raw_input();
c={}
for u,v,t in re.findall("(?=([0-3][0-9])-([0-1][0-2])-(201[345]))",a):
#    print u," ",v," ",t
    if validDate(int(u),int(v),int(t))==True:
        c[u+'-'+v+'-'+t]=(c.get(u+'-'+v+'-'+t) or 0) +1
print sorted(c.iteritems(),key=lambda x:x[1])[-1][1]
