import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class SolutionB {
        void solve() throws IOException {
            String inp=next();
            //String inp="13";
            //int aa=100/6+1;
            //for(int i=0;i<aa;i++){
            //    inp+="-10-2013";
            //}
            int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
            ArrayList<String> dates = new ArrayList<String>();
            for(int i=0;i<12;i++){
                for(int d=1;d<=month[i];d++){
                    String to="0"+d;
                    if(d>=10)
                        to=""+d;
                    dates.add(to+"-"+(i+1)+"-2013");
                    dates.add(to+"-"+(i+1)+"-2014");
                    dates.add(to+"-"+(i+1)+"-2015");
                }
            }
            int n=dates.size();
            int max=0;
            String res="";
            for(int i=0;i<n;i++){
                String find=dates.get(i);
                int s=Integer.parseInt(find.charAt(0)+""+find.charAt(1));
                int q=10;
                if(s==14 || s==13 || s==15)q=8;
                StringBuilder temp = new StringBuilder(inp);
                int count=0;
                int p=0;
                while(true){
                    p=temp.indexOf(find,p);
                    if(p<0) break;
                    p+=q;
                    count++;
                }
                if(max<count){
                    res=find;
                    max=count;
                }
            }
            System.out.println(res);
            


	}


	BufferedReader in;
	StringTokenizer str;
	PrintWriter out;
	String SK;

	String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	
	void run() throws IOException {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
		//in = new BufferedReader(new FileReader("input.txt"));
		//out = new PrintWriter("output.txt");
                solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new SolutionB().run();
	}

}
