import re
s=raw_input();
matches = re.finditer(r'(?=(\d{2}[-]\d{2}[-]\d{4}))',s)
results = [str(match.group(1)) for match in matches]

l=len(results)
A=[0]*l

for xx in results:
	arr=xx.split("-");
	
	if int(arr[2]) > 2015 or int(arr[2])<2013:
		continue
	if int(arr[1]) > 12 or int(arr[1])<1:
		continue
	if int(arr[1]) == 4 or int(arr[1]) == 6 or int(arr[1]) == 9 or int(arr[1]) == 11:
		if int(arr[0]) < 0 or int(arr[0])>30:
			continue
	elif int(arr[1]) == 2:
		if int(arr[0]) < 0 or int(arr[0])>28:
			continue
	else:
		if int(arr[0]) < 0 or int(arr[0])>31:
			continue
	for i in xrange(l):
		if results[i]==xx:
			A[i]=A[i]+1
			break

if l!=0:
	y=max(A)
	if y>0:
		print results[A.index(max(A))]
