readints=lambda :map(int , raw_input().split())
st=raw_input()
days=[0,31,28,31,30,31,30,31,31,30,31,30,31];
mx=0
res=""
tl=len(st);
dates=set();
for ye in (2013,2014,2015):
	for mo in range(1,13):
		for da in range(1,days[mo]+1):
			date="%.2d-%.2d-%d" % (da,mo,ye)
			dates.add(date)
mp={};
for i in range(tl-9):
	ss=st[i:i+10];
	if ss in dates:
		if mp.has_key(ss):
			mp[ss]+=1;
		else :
			mp[ss]=1
for i in mp.keys():
	if mp[i]>mx:
		mx=mp[i]
		res=i;

print res


