import re
import time

def correct_date(s):
  try:
    date_obj = time.strptime(s, "%d-%m-%Y")
    return date_obj.tm_year >= 2013 and date_obj.tm_year <= 2015
  except:
    return False

def solve(s):
  date = re.compile("\\d{2}-\\d{2}-\\d{4}")
  corrects = dict()

  substring = ""
  pos = 0
  while True:
    substring = date.search(s, pos)

    if substring is None:
      break

    occurence = substring.group()
    pos = substring.start() + 1
    if correct_date(occurence):
      corrects[occurence] = corrects.get(occurence, 0) + 1

  print max(corrects, key=corrects.get)

string = str(raw_input())
solve(string)
