import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.util.Set;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vaibhav Mittal
 */
public class Main {
	public static void main(String[] args) throws Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
	public void solve(int testNumber, BufferedReader in, PrintWriter out) throws Exception {
        String s = in.readLine();
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        for (int i = 0, j = 10; j <= s.length(); ++i, ++j) {
            String t = s.substring(i, j);
            if (isValidDate(t)) {
                if (!map.containsKey(t)) map.put(t, 0);
                map.put(t, map.get(t) + 1);
            }
        }
        String res = "";
        int best = 0;
        for (String t : map.keySet()) {
            if (best < map.get(t)) {
                best = map.get(t);
                res = t;
            }
        }
        out.println(res);
	}

    public boolean isValidDate(String t) {
        String[] u = t.split("-");
        if (u.length != 3) return false;
        int day = 0;
        int month = 0;
        int year = 0;
        try {
            day = Integer.parseInt(u[0]);
            month = Integer.parseInt(u[1]);
            year = Integer.parseInt(u[2]);
        } catch (NumberFormatException e) {
            return false;
        }
        if (year < 2013 || year > 2015) return false;
        if (month < 1 || month > 12) return false;
        int[] numDays = {0,31,28,31,30,31,30,31,31,30,31,30,31};
        if (day < 1 || day > numDays[month]) return false;
        return true;
    }
}