#!/usr/bin/env python
import re
import datetime

s = raw_input()
regex = re.compile('(((0[1-9]|[12]\d|3[01])-(0[13578]|1[02])-(201[3-5]))|((0[1-9]|[12]\d|30)-(0[13456789]|1[012])-(201[3-5]))|((0[1-9]|1\d|2[0-8])-02-(201[3-5])))')

dic = {}
pos = 0
while True:
        match = regex.search(s, pos)
        if not match:
                break

        date = match.group()
        if not dic.has_key(date):
                dic[date] = 1
        else:
                dic[date] += 1

        pos = match.start() + 1

print sorted(dic, key=dic.get)[-1]