ch = raw_input().split('-')
print ch
myd = [0,31,28,31,30,31,30,31,31,30,31,30,31]
mp = {}
for i in xrange(len(ch)-2):
	if ch[i] == '' or ch[i+1] == '' or ch[i+2] == '':
		continue
	y = eval(ch[i+2][:4])
	if 2013<= y <= 2015:
		m = eval(ch[i+1])
		if 1 <= m <= 12:
			d = eval(ch[i][len(ch[i])-2:])
#			print y,m
			if 1 <= d <= myd[m] :
				nc = '-'.join([str(d),str(m),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
