import java.util.*;
public class B {
	HashMap<String, Integer> dates = new HashMap<String, Integer>();
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		HashMap<String, Integer> dates = new HashMap<String, Integer>();
		String s = input.nextLine();
		int n = s.length();
		String ret = "";
		int max = 0;
		outer:for(int i = 0; i < n - 10; i++){
			for(int j = 0; j < 10; j++){
				if((j == 2 || j == 5)){
					if(s.charAt(i + j) != '-')
						continue outer;
				}
				else if(s.charAt(i + j) == '-')
					continue outer;
 			}
			String date = s.substring(i, i + 10);
			int d = Integer.parseInt(date.substring(0, 2));
			int m = Integer.parseInt(date.substring(3, 5));
			int y = Integer.parseInt(date.substring(6, 10));
			if(y < 2013 || y > 2015 || m > 12 || d > 31)
				continue;
			if(d > 30 && (m == 4 || m == 6 || m == 9 || m == 11))
				continue;
			if(m == 2 && d > 28)
				continue;
			if(!dates.containsKey(date))
				dates.put(date, 1);
			else
				dates.put(date, dates.get(date) + 1);
			if(dates.get(date) > max){
				ret = date;
				max = dates.get(date);
			}
		}
		System.out.println(ret);
	}
}
