import re


#line = "777-444---21-12-2013-12-2013-12-2013---444-777"
line = raw_input()
dictt={}

r=re.compile('\d\d-\d\d-\d\d\d\d')
while True:
	var= r.search(line)
	if(var==None):
		break
	out=str(var.group())
	if(dictt.has_key(out)):
		dictt[out]+=1
	else:
		dictt[out]=1
	ind=line.find(out)
	line=line[ind+8:]
	#print out

#print dictt
out=""
maxi=-9
for x,y in dictt.items():
	if(y>maxi):
		maxi=y
		out=x
print out
