import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;


public class B {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new B().run();
    }
    void run(){
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        PrintStream printer = new PrintStream(System.out);
        String prophesy = scanner.next();
        int month31[] = {1,3,5,7,8,10,12};
        int month30[] = {3,6,9,11};
        int month28[] = {2};
        String dates[] = new String[50000];
        int occurr[] = new int[50000];
        int pos = 0;
        for(int y = 2013 ; y <= 2015 ; ++y){
            for(int i = 0 ; i < 7 ; ++i){
                int m = month31[i];
                for(int d = 1 ; d <= 31 ; ++d){
                    String date = String.format("%02d", d) +"-"+ String.format("%02d", m)+ "-" + y;
                    int found = prophesy.indexOf(date, 0);
                    if ( found != -1 ){
                        dates[pos] = date;
                        occurr[pos] = 0;
                        while((found = prophesy.indexOf(date, found+1))!=-1){
                            ++occurr[pos];
                        }
                        ++pos;
                    }
                    
                }
            }
            for(int i = 0 ; i < 4 ; ++i){
                int m = month30[i];
                for(int d = 1 ; d <= 30 ; ++d){
                    String date = String.format("%02d", d) +"-"+ String.format("%02d", m)+ "-" + y;
                    int found = prophesy.indexOf(date, 0);
                    if ( found != -1 ){
                        dates[pos] = date;
                        occurr[pos] = 0;
                        while((found = prophesy.indexOf(date, found+1))!=-1){
                            ++occurr[pos];
                        }
                        ++pos;
                    }
                    
                }
            }
            for(int i = 0 ; i < 1 ; ++i){
                int m = month28[i];
                for(int d = 1 ; d <= 28 ; ++d){
                    String date = String.format("%02d", d) +"-"+ String.format("%02d", m)+ "-" + y;
                    int found = prophesy.indexOf(date, 0);
                    if ( found != -1 ){
                        dates[pos] = date;
                        occurr[pos] = 0;
                        while((found = prophesy.indexOf(date, found+1))!=-1){
                            ++occurr[pos];
                        }
                        ++pos;
                    }
                    
                }
            }
        }
        int mx = 0;
        for(int i = 1 ; i < pos ; ++i){
            if ( occurr[i] > occurr[mx] ){
                mx = i;
            }
        }
        printer.println(dates[mx]);
        scanner.close();
    }

}
