encrypted = raw_input();

def isDate(date):
    bool = False;
    if date[2] == "-" and date[5] == "-" and date.count("-") <= 2 and date[6:] == "2013" or date[6:] == "2014" or date[6:] == "2015":
        bool = True;
    return bool;

if len(encrypted) == 10 and isDate(encrypted):
    print encrypted;
else:
    decrypted = {};
    for i in range(len(encrypted)-9):
        count = 1;
        date = encrypted[i:i+10];
        if isDate(date):
            if date in decrypted:
                count = decrypted[date] + 1;
                decrypted[date] = count;
            else:
                decrypted[date] = count;
    
    sortedArr = sorted(decrypted, key=lambda key: decrypted[key]);
    print sortedArr[len(sortedArr)-1];
