def check(d,m,y):
 if (2013<=y<2015)and (1<=m<=12):
 	if (m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12)and(1<=d<=31): return True
 	elif (m==4 or m==6 or m==9 or m==11)and(1<=d<31):return True
 	elif m==2 and 1<=d<=28: return True
 	else: return False 

def new(s):
	if len(s)==1 : return '0'+s
	else: return s

class Day:
   def __init__(self,d=0,m=0,y=0):
   	self.d=d
   	self.m=m
   	self.y=y
   def __str__(self):
   	sd=new(str(self.d))
   	sm=new(str(self.m))
   	return sd+'-'+sm+'-'+str(self.y)

s=raw_input()
e=[0]*32
w=[e]*14
bool=[w]*3
ans=[]
a=[]

for i in range(len(s)-9):
	sd=s[i:i+2]
	if '01'<=sd<='31':pass
	else: continue
	sm=s[i+3:i+5]
	if '01'<=sm<='31':pass
	else: continue
	sy=s[i+6:i+10]
	if '2013'<=sy<'2015':pass
	else: continue
	d=int(sd)
	m=int(sm)
	y=int(sy)
	c=Day(d,m,y);
	if check(d,m,y): bool[y-2013][m][d]+=1;a+=[c];
maxd=Day();
maxx=-1
for i in a:
 if bool[i.y-2013][i.m][i.d]>maxx: maxx=bool[i.y-2013][i.m][i.d];maxd=i
print str(maxd)
