import re
from calendar import monthrange
s=raw_input()
c={}
for d,m,y in re.findall('(?=([0-9][0-9])-([0-9][0-9])-(201[345]))',s):
  u,v,w=int(d),int(m),int(y)
  if v>0 and v<13 and u>0 and u<=monthrange(w,v)[1]:
    t=d+'-'+m+'-'+y
    c[t]=(c.get(t) or 0)+1
print sorted(c.iteritems(),key=lambda x:x[1])[-1][0]
