import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class A1 {
	public static void main (String args[]){
		Scanner in = new Scanner(System.in);
		String tmp = in.nextLine();
		Pattern p = Pattern.compile("([0-2][0-9]|3[0-1])-(0[0-9]|1[0-2])-201+[3-5]");
		Matcher m = p.matcher(tmp);
		Map<String, Integer> map = new TreeMap<String, Integer>();
		int max = -1 ;
		String ans = "";
		while(m.find()){
			String st = m.group();
			if(map.containsKey(st)){
				int count = map.get(st)+1;
				if(count > max){
					ans = st;
					max = count;
				}
				map.put(st, count);
			}
			else{
				map.put(st, 1);
				int count = 1 ;
				if(count >= max){
					ans = st;
					max = count;
				}
			}
		}
		System.out.println(ans);
	}
}