#!/usr/bin/python
def main():
	in1 = raw_input().split('-')
	dct = {}
	lst = ""
	for i in range(len(in1) - 2):
		if (in1[i] == '' or in1[i+1] == '' or in1[i+2] == '') :
			continue
		if int(in1[i+1]) <= 12 and int(in1[i+1]) > 0 and len(in1[i+1]) == 2 and int(in1[i+2]) >= 2013 and int(in1[i+2]) <= 2015 and  len(in1[i]) >= 2 and len(in1[i+2]) == 4:
			date = in1[i][-2:]
			dat = int(date)
			if dat == 0:
				continue
			m = int(in1[i+1])
			lst = ""
			if dat <= 31 and dat > 0:
				lst = date+in1[i+1]+in1[i+2]
			else:
				continue
			if lst not in dct:
				dct[lst] = 1
			else:
				dct[lst] = dct[lst] + 1
	maxi = 0 
	out = ""
	for el in dct :
		if dct[el] > maxi:
			maxi = dct[el]
			out = el
	print out[:2] + "-"+out[2:4]  + "-" + out[4:8]

if __name__=='__main__':
	main()
