ch = raw_input().split('-')
myd = [0,31,28,31,30,31,30,31,31,30,31,30,31]
mp = {}
y,m,d=0,0,0
def cal(d):
	if len(d) != 2:
		return 0
	return int(d)
for i in xrange(len(ch)-2):
	if ch[i] == '' or ch[i+1] == '' or ch[i+2] == '':
		continue
	y = ch[i+2][:4]
	y = int(y)
	if 2013<= y <= 2015:
		m = cal(ch[i+1])
		if 1 <= m <= 12:
			d = ch[i][len(ch[i])-2:]
			d = cal(d)
#			print y,m
			if 1 <= d <= myd[m] :
				nc = '-'.join([str(d).zfill(2),str(m).zfill(2),str(y)])
				if nc in mp:
					mp[nc] = mp[nc] + 1
				else :
					mp[nc] = 1
ans ,s = '',0
for c in mp:
	if mp[c] > s:
		s = mp[c]
		ans = c
print ans
