import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Map.Entry;

public class B {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] strs = str.split("-");
        ArrayList<String[]> array = new ArrayList<String[]>();
        for (int i = 0; i < strs.length; i++) {
            if (!strs[i].equals("")) {
                array.add(new String[] { strs[i] });
            }
        }
        array.remove("");
        strs = new String[array.size()];
        int i = 0;
        for (String[] strings : array) {
            strs[i] = strings[0];
            i++;
        }
        i = 2;
        HashMap<String, Integer> list = new HashMap<String, Integer>();
        while (i < strs.length) {
            if (strs[i].length() >= 4) {
                String yyyy = strs[i].substring(0, 4);
                if (strs[i - 1].length() < 2 || strs[i - 2].length() < 2) {
                    i++;
                    continue;
                }
                String mm = strs[i - 1].substring(strs[i - 1].length() - 2);
                String dd = strs[i - 2].substring(strs[i - 2].length() - 2);
                if (Integer.parseInt(yyyy) < 2013
                        || Integer.parseInt(yyyy) > 2015) {
                    i++;
                    continue;
                } else if (Integer.parseInt(mm) <= 0
                        || Integer.parseInt(mm) > 12) {
                    i++;
                    continue;
                } else if (Integer.parseInt(dd) <= 0
                        || Integer.parseInt(dd) > 31) {
                    i++;
                    continue;
                } else {
                    int m = Integer.parseInt(mm);
                    int d = Integer.parseInt(dd);
                    if (((m == 4 || m == 6 || m == 9 || m == 11) && d > 30)
                            || (m == 2 && d > 29)) {
                        i++;
                        continue;
                    }
                    String s = dd + "-" + mm + "-" + yyyy;
                    if (list.containsKey(s)) {
                        int t = list.get(s);
                        t++;
                        list.remove(s);
                        list.put(s, t);
                    } else {
                        list.put(s, 1);
                    }
                }
                i++;
            } else {
                i++;
            }
        }
        Entry<String, Integer> min = null;
        for (Entry<String, Integer> entry : list.entrySet()) {
            if (min == null) {
                min = entry;
            } else if (entry.getValue() > min.getValue())
                min = entry;
        }
        System.out.println(min.getKey());
    }
}