from operator import itemgetter

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def is_valid(d, m, y):
    try:
        y = int(y)
    except:
        return False
        
    if y < 2013 or y > 2015:
        return False

    try:
        m = int(m)
    except:
        return False
    
    if m == 0 or m > 12:
        return False

    try:
        d = int(d)
    except:
        return False
    
    if d == 0 or month[m-1] < d:
        return False
        
    return True

s = raw_input().strip()
c = {}
for i in xrange(len(s)):
    try:
        d, del1, m, del2, y = s[i:i+2], s[i+2], s[i+3:i+5], s[i+5], s[i+6:i+10]
    except IndexError:
        d, del1, m, del2, y = [None] * 5

    if (del1 == "-") and (del2 == "-") and is_valid(d, m, y):
        dt = "-".join([d, m, y])
        c[dt] = c.get(dt, 0) + 1
        
print max(c.items(), key=itemgetter(1))[0]