import re
s = raw_input()
x=re.finditer(r'(?=(\d\d-\d\d-\d\d\d\d))',s)
ans={}
days= [0,31,28,31,30,31,30,31,31,30,31,30,31]
for i in x:
	i=i.group(1)
	day=i[:2]
	month = i[3:5]
	year = i[6:]
	#print i, day, month, year
	if (int(year) >= 2013 and int(year) <= 2015) and (int(month) >0 and int(month)<13) and (int(day)>0 and int(day) <= days[int(month)]) :
		if i in ans:
			ans[i]+=1
		else:
			ans[i]=1
max_cnt=0
max_ans=""
#print ans
for i in ans:
	if ans[i]>max_cnt:
		max_ans = i
		max_cnt = ans[i]

#print ans
print max_ans