# -*- coding: utf-8 -*-

import re
text = raw_input()

length = len(text)

years = [2013, 2014, 2015]

m_days = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}

res = {}

cur_max = 0
cur_s = ''

ind = range(0,10)

for i in xrange(0, length-9):
	s = text [i:(i+10)]
	try:
		if ((s[2]!='-') or (s[5]!='-')):
			continue
		year =  int(s[6:10]) 
		if year not in years:
			continue
		month = int(s[3:5])
		if ((month > 12) or (month <= 0)):
			continue
		days = int(s[0:2])
		if ((days <= 0) or (days > m_days[month])):
			continue
	except ValueError:
		continue
	tmp = 1 
	if s in res:
		tmp = res[s] + 1
		res[s] = tmp
	else:
		res[s] = tmp
	if tmp > cur_max:
		cur_s = s
		cur_max = tmp

print cur_s 
