encrypted = raw_input();
print encrypted;

def isDate(date):
    print "-----";
    print 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;
    print bool
    return bool;

decrypted = {};
for i in range(len(encrypted)-10):
    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;

print decrypted;
sortedArr = sorted(decrypted, key=lambda key: decrypted[key]);
print sortedArr;
print sortedArr[len(sortedArr)-1];
