import java.util.ArrayList;
import java.util.Calendar;
import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        B problem = new B();
        problem.solve();
    }

    private void solve() {
        Scanner sc = new Scanner(System.in);
            
        String s = sc.next();
        int[] d = {0,31,28,31,30,31,30,31,31,30,31,30,31};
        ArrayList<String> datas = new ArrayList<String>();
        ArrayList<Integer> count = new ArrayList<Integer>();
        
        
        int tam = s.length();
        
        for(int i=2; i<tam-7; i++){
            if(s.charAt(i) =='-' && s.charAt(i+3)== '-'){
                int mes=13;
                int dia=32;
                int ano = 0;
                if(!(s.substring(i+1, i+3).contains("-")))  mes = Integer.parseInt(s.substring(i+1, i+3));
                if(mes >0 && mes < 13 ){
                    if(!(s.substring(i-2, i).contains("-"))) dia = Integer.parseInt(s.substring(i-2, i));
                    if(dia >0 && dia < d[mes]){
                        if(!(s.substring(i+4, i+8).contains("-"))) ano = Integer.parseInt(s.substring(i+4, i+8));
                        if(ano > 2012 && ano < 2016){
                            String data = dia+"-"+mes+"-"+ano;
                            boolean addi = false;
                            for(int j = 0; j< datas.size(); j++){
                                if (data.equals(datas.get(j))){
                                    count.add(j,count.get(j)+1);
                                    addi = true;
                                }
                            }
                            if (!addi){
                                datas.add(data);
                                count.add(1);
                            }
                        }
                    }
                }
            }
        }
        int max = 0;
        for(int i =1; i<count.size();i++){
            if (count.get(i) > count.get(max)){
                max = i;
            }
            
        }
        
        System.out.println(datas.get(max));
        
    }
    
}
