def is_int(s):
    try: 
        int(s)
        return True
    except ValueError:
        return False
    
a=raw_input()
app={}
for i in xrange(len(a)-9):
    if is_int(a[i:i+2]) and is_int(a[i+3:i+5]) and a[i+2]==a[i+5]=='-' and is_int(a[i+6:i+10]):
        d,m,y=int(a[i:i+2]),int(a[i+3:i+5]),int(a[i+6:i+10])
        if y in xrange(2013,2016) and m<=12 and ((d<=31 and m!=3) or (m==3 and d<=28)):
            
            if str(a[i:i+10]) in app:
                app[str(a[i:i+10])]+=1
            else:
                app[str(a[i:i+10])]=1
print sorted(app,key=app.get)[-1]