
x = raw_input()
arr = x.split('-')
arr = filter(None, arr)



outs = []
for i in range(len(arr)):
	if('2013' in arr[i]  or '2014' in arr[i]  or '2015' in arr[i]):
		if ( i > 1):
			if(int (arr[i-1] ) > 0 and int (arr[i-1] ) < 13 ):
				temp = arr[i-2][-2:] 
				
				if(int(temp) > 0 and int(temp) < 31):
					
					arr[i] = arr[i][0:4]
					temp = temp + "-" + arr[i-1]+"-" + arr[i]
					outs.append(temp);

		if ( i <= len(arr)-2):
			temp = arr[i][:-2]
			if(temp > 0 and temp < 31):
				if(int (arr[i+1] ) > 0 and int (arr[i+1] ) < 13 ):
					if('2013' in arr[i+2] or '2014' in arr[i+2] or '2015' in arr[i+2]):
						arr[i] = arr[i][0:4]
						temp = temp + "-" + arr[i+1]+"-" + arr[i+2]
						outs.append(temp);

count=0
result=0;

for i in range(len(outs)):
	for j in range(len(outs)):
		if(i != j):
			if(outs[i] == outs[j]):
					count=count+1
	if(count > result):
		count=0
		result = i;

print outs[result];


