mm = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def dig(s, q, l):
    for i in range(l):
        if not s[q+i].isdigit():
            return -1
    return int(s[q:q+l])

def dat(s, q):
    d = dig(s, q, 2)
    m = dig(s, q + 3, 2)
    y = dig(s, q + 6, 4)
#    print d,m,y,s[q:q+10]
    if d < 1 or m < 1 or m > 12 or d > mm[m - 1] or \
       y < 2013 or y > 2015 or s[q+2] != '-' or s[q+5] != '-':
        return None
    return s[q:q+10]

def main():
    input = raw_input()
    m = {}
    for i in range(len(input) - 10):
        td = dat(input, i)
        if td is not None:
            if not m.has_key(td):
                m[td] = 0
            m[td] += 1
    ans = ''
    l = -1
    for i in m.keys():
        if m[i] > l:
            ans = i
            l = m[i]
    print ans


main()