
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        while (in.hasNext()) {
            String line = in.nextLine();
            String rpta = "";

            int anio[] = { 2013, 2014, 2015 };
            int mes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            int arr[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

            String fechas[] = new String[5000];
            int cont[] = new int[5000];
            Arrays.fill(fechas, "");
            
            int a=0;
                for (int i2 = anio.length-1; i2 >-1; i2--) {
                        for (int j2 = arr.length-1; j2 >-1; j2--) {
                            for (int k = arr[j2]-1; k >0 ; k--) {   
                                fechas[a] = (k + "-" + mes[j2] + "-" + anio[i2]);
                                a++;
                            }
                    }   
                }
                


                int b=-1;
                for (int j = 0; j < fechas.length; j++) {
                    String line2 = line;
                    int c=-1;
                    if (line2.contains(fechas[j])) {
                        c=line2.indexOf(fechas[j]);
                        cont[j]++;
                    }
                    int d=-1;
                    if (line2.contains(fechas[j])&&c!=-1) {
                        d=line2.indexOf(fechas[j],c+1);
                        if(d!=-1)cont[j]++;
                    }
                    if(cont[j]==2){
                        b=j;
                        break;
                    }
                }
                
                out.println(fechas[b]);
            }
            in.close();
            out.close();
        }


    }
