import java.util.HashMap;


public class S260B {
	int[]M = new int[]{31, 28, 31, 30, 31, 20, 31, 31, 30, 31, 30, 31};
	
	boolean check(String s){
		if(!s.matches("\\d\\d-\\d\\d-\\d\\d\\d\\d"))return false;
		int d = Integer.parseInt(s.substring(0,2));
		int m = Integer.parseInt(s.substring(3,5));
		int y = Integer.parseInt(s.substring(6));
		if(y<2013||y>2015)return false;
		m--;
		if(m<0||m>11)return false;
		if(d<1||d>M[m])return false;
		return true;
			
	}
	
	String doit(String s){
		HashMap<String, Integer>H = new HashMap<>();
		String res="err";
		int best = 0;
		for(int i=0;i+10<=s.length();i++){
			String d = s.substring(i,i+10);
			if(check(d)) {
				int cnt = 0;
				if(H.containsKey(d))cnt = H.get(d);
				cnt ++;
				H.put(d, cnt);
				if(cnt>best){best = cnt;res = d;}
				
			}
		}
		return res;
	}
	
	public static void main(String[] args) {
		System.out.println(new S260B().doit("777-444---21-12-2013-12-2013-12-2013---444-777"));
	}
}
