#!/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 len(in1[i+1]) == 2and 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)
			m = int(in1[i+1])
			lst = ""
			if (m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12) and dat <= 31:
				lst = lst+ date+in1[i+1]+in1[i+2]
			elif (m == 4 or m == 6 or m == 9 or m == 11) and dat <= 30:
				lst = lst + date+in1[i+1]+in1[i+2]
			elif m == 2 and dat <= 28:
				lst = 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()
