def main():
	s = raw_input()
	mon = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
	ans, cnt = "", 0
	for i in xrange(2013, 2016):
		for j in xrange(1, 13):
			for k in xrange(1, mon[j - 1] + 1):
				t = (str(k) if k >= 10 else ("0" + str(k))) + "-" + (str(j) if j >= 10 else ("0" + str(j))) + "-" + str(i)
				cntNew = s.count(t)
				if cntNew > cnt: ans, cnt = t, cntNew
	print ans

if __name__ == "__main__": main()