from collections import defaultdict
line = raw_input()
datedict = defaultdict(int)
for i in xrange(0, len(line) - 10 + 1):
  date = line[i:i + 10]
  try:
    day = int(date[0:2])
    month = int(date[3:5])
    year = int(date[6:10])
  except:
    continue
  if date[2] != '-' or date[5] != '-': continue
  if year < 2013 or year > 2015: continue
  if month < 1 or month > 12: continue
  if day > 31 or day < 1: continue
  if month in [2,4,6,9,11] and day > 30: continue
  if month == 2 and day > 28: continue
  datedict[date] += 1
print max([(datedict[key], key) for key in datedict])[1]
