import java.util.*;


public class b {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine(); int mx = 0; String ans = "";
		int [] months = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		Dictionary d=new Hashtable(); 
		for (int i = 0; i <= s.length() - 10; i++) 
		if (ok(s.charAt(i)) && ok(s.charAt(i + 1)) && ok(s.charAt(i + 3)) && ok(s.charAt(i + 4))
		&& ok(s.charAt(i + 6)) && ok(s.charAt(i + 7)) && ok(s.charAt(i + 8)) && ok(s.charAt(i + 9))){
			int day = Integer.parseInt(s.substring(i, i + 2));
			int month = Integer.parseInt(s.substring(i + 3, i + 5));
			int year = Integer.parseInt(s.substring(i + 6, i + 10));
			if (year > 2015 || year < 2013) continue;
			if (month > 12 || month < 1) continue;
			if (day > months[month - 1] || day < 1) continue;
			String kkey = day + "-" + month + "-" + year;
			if (d.get(kkey) != null) 
				d.put(kkey, (int) d.get(kkey) + 1);
			else d.put(kkey, 0);
			if ((int) d.get(kkey) >= mx) {
				mx = (int) d.get(kkey);
				ans = kkey;
			}
		}
		System.out.print(ans);
	}

	private static boolean ok(char q) {
		if (q >= '0' && q <= '9') return true;
		return false;
	}

}
