

from collections import Counter

x = raw_input()
arr = x.split('-')

for i in range(len(arr)):
	if( arr[i] is ''):
		arr[i] = '0'

outs = []
days = [31,28,31,30,31,30,31,31,30,31,30,31]
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 ):
				temp1 = arr[i-2]
				temp2 = temp1[-2:]
				month = int(arr[i-1])-1
				if(int(temp2) > 0 and int(temp2) <= days[month]):				
					temp3 = arr[i][0:4]
					if(temp3 == '2013' or temp3 == '2014' or temp3 == '2015'):
						temp = temp2 + "-" + arr[i-1]+"-" + temp3
						outs.append(temp);

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

count=0
result=0;

cnt = Counter(outs)
temp =  cnt.most_common(1)
print temp[0][0]
