import sys
st = raw_input().strip()
date = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

count = {}

l = len(st)
for i in range(2, l - 7):
	if st[i] != '-':
		continue
	if st[i + 3] != '-':
		continue
	try:
		day = int(st[i - 2: i])
		month = int(st[i + 1: i + 3])
		year = int(st[i + 4: i + 8])
	except:
		continue
	#print year, month, day
	if year < 2013 or year > 2015:
		continue
	if month < 1 or month > 12:
		continue
	if day < 1 or day > date[month]:
		continue
	try:
		count[st[i - 2 : i + 8]] += 1
	except:
		count[st[i - 2 : i + 8]] = 1

ans = ''
cnt = 0

for i in count:
	if count[i] > cnt:
		ans = i
		cnt = count[i]

print ans
