dates = {}
s = raw_input()

for i in range(2,len(s)-4):
    if s[i] == "-":
        d = s[i-2:i]
        m = s[i+1:i+3]
        y = s[i+4:i+8]
        #print d, m, y
        if d.isdigit() and m.isdigit() and y.isdigit():
            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]):
                        # add to dates
                        date = s[i-2:i+8]
                        if date not in dates:
                            dates[date] = 1
                        else:
                            dates[date] += 1

ad = ""
mx = -1
for k,v in dates.items():
    if mx < v:
        mx = v
        ad = k

print k
