import re
p = re.compile('(?=((\d\d)-(\d\d)-(\d\d\d\d)))')
q = dict()
mm = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
for mt in p.finditer(raw_input()):
	d, m, y = map(int, mt.group(2, 3, 4))
	if y in [2013, 2014, 2015] and m in range(1, 13) and d in range(1, mm[m] + 1):
		if mt.group(1) not in q:
			q[mt.group(1)] = 1
		else:
			q[mt.group(1)] += 1
ans = ''
res = 0
for k, v in q.iteritems():
	if v > res:
		ans = k
		res = v
print ans