#!/usr/bin/env python

import sys
import math
import string
from copy import *;
from collections import deque


# Function #
def read_int() :
    temp = raw_input().split();
    return map(int, temp);

def read_str() :
    temp = raw_input().split();
    return temp;

def write(output) :
    sys.stdout.write(output);

def writeln(output) :
    sys.stdout.write(str(output)+'\n');
# Class #


INF = 9123456789123456789
# Main Entry #


# Inner Function #
date = [31,28,31,30,31,30,31,31,30,31,30,31];
def gen_check_date(strin) :
    max_date = -1;
    max_str = "-1";
    for ii in xrange(2013, 2016) :
        for jj in xrange(1, 13) :
            for kk in xrange(1, date[jj-1]+1) :
                strnow = '%.2d-%.2d-%.4d'%(kk, jj, ii);
                freq = strin.count(strnow);
                if (freq > max_date) :
                    #print freq, strnow;
                    max_date = freq;
                    max_str = strnow;
                pass
            pass
        pass
    pass
    print max_str;

if __name__ == '__main__':

    gen_check_date(raw_input());
    pass
# End Here #

