import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

    public class MainMain {
    	static ArrayList<String> list = new ArrayList<String>();
    	static ArrayList<Integer> listi = new ArrayList<Integer>();
        public static void main(String args[]){
        	Scanner input = new Scanner(System.in);
        	String s = input.nextLine();
        	System.out.println(starts(s));
        }
        
        public static String starts(String s){
        	for(int i = 0 ; i < s.length(); i++){
        		int count = 0;
        		for(int j = i ; j < s.length(); j++){
        			if(count == 2){
        				String[] st = s.substring(i,j).split("-");
        				if(st.length == 2 && (j+4) <= s.length()){
        					String year = s.substring(j,j+4);
        					//System.out.println(i+","+j);
        					checkFormat(st[0],st[1],year);
        				}
        				break;
        			}
        			if(s.charAt(j) == '-')count++;
        		}
        	}
        	int max = 0;
        	int index = -1;
        	for(int i = 0 ; i < list.size() ; i++){
        		//System.out.println(listi.get(i)+","+list.get(i));
        		if(max < listi.get(i)){
        			index = i;
        			max = listi.get(i);
        		}
        	}
        	return list.get(index);
        		
        }
        
        public static void checkFormat(String s0,String s1,String s2){
        	try{
        		
        		if(s0.length() == 2 && s1.length() == 2){
	        		//System.out.println(s0+","+s1+","+s2);
	        		int a = Integer.parseInt(s0);
	        		int b = Integer.parseInt(s1);
	        		int c = Integer.parseInt(s2);
	        		if(1<=a && a<= 31 && 0<= b && b <= 12 && 2013<= c && c <= 2015){
	        			if(datecheck(a,b)){
		        			if(list.contains(s0+"-"+s1+"-"+s2)){
		        				listi.set(list.indexOf(a+"-"+b+"-"+c),listi.get(list.indexOf(a+"-"+b+"-"+c))+1);
		        			}else{
		        				list.add(s0+"-"+s1+"-"+s2);
		        				listi.add(1);
		        			}
	        			}
        				//System.out.println("aaa"+a+"-"+b+"-"+c+","+i+","+j);
	        		}
        		}
        	}catch(Exception e){
        		
        	}
        }
        
        public static boolean datecheck(int a,int b){
        	if(b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12){
        		return true;
        	}else if(b == 2){
        		if(a >= 29)return false;
        		return true;
        	}else if(b == 4 || b == 6 || b == 9 || b == 11){
        		if(a >= 31)return false;
        		return true;
        	}
        	return false;
        }
        
    }