import re

def valid(d, m, y):
	mnth = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31}
	if y>=2013 and y<=2015:
		if m>=1 and m<=12:
			if d>=1 and d<=mnth[m]:
				return 1
	return 0

s = raw_input()
dates = re.findall(r'\d\d-\d\d-\d\d\d\d', s)
mp = {}
for date in dates:
	d = int(date[0:2])
	m = int(date[3:5])
	y = int(date[6:])
	if valid(d, m, y):
		if date in mp:
			mp[date] += 1
		else:
			mp[date] = 1
			
ans = ""
m = 0
for date in mp:
	if mp[date]>m:
		ans = date
		m = mp[date]
		
print ans
