dates = {}
s = raw_input()

for i in range(2,len(s)-7):
    if s[i] == "-":
        d = s[i-2:i]
        m = s[i+1:i+3]
        y = s[i+4:i+8]
        #print d, m, y
        #print d.isdigit(), m.isdigit(), y.isdigit(), s[i+3] == "-"
        if d.isdigit() and m.isdigit() and y.isdigit() and s[i+3] == "-":
            if int(y) in [2013, 2014, 2015]:
                mi = int(m)
                if mi in range(1,13):
                    di = int(d)
                    cur = [0,31,28,31,30,31,30,31,31,30,31,30,31]
                    if di in range(1,cur[mi]+1):
                        # add to dates
                        date = s[i-2:i+8]
                        #print date
                        if date not in dates:
                            dates[date] = 1
                        else:
                            dates[date] += 1
#print dates
ad = ""
mx = -1
for k,v in dates.items():
    if mx < v:
        mx = v
        ad = k
print ad
