import java.io.*;
import java.util.*;

public class B {

    void run() throws IOException {
        int[] c = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        int[][][] a = new int[3][12][31];
        String[] l = nl().split("-");
        for (int i = 2; i < l.length; i++) {
            String x = l[i - 2], y = l[i - 1], z = l[i];
            try {
                if (!(x.length() < 2 || y.length() < 2 || z.length() < 4)) {
                    int d = Integer.parseInt(x) % 100;
                    int m = Integer.parseInt(y);
                    if (z.length() > 4)
                        z = z.substring(0, 4);
                    int q = Integer.parseInt(z);
                    if (q >= 2013 && q <= 2015 && m <= 12 && m > 0 && d <= c[m - 1] && d > 0) {
                        a[q - 2013][m - 1][d - 1]++;
                    }
                }
            } catch (Exception e) {
            }
        }
        int md = 0, my = 0, mm = 0;
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 12; j++)
                for (int k = 0; k < 31; k++)
                    if (a[i][j][k] > a[my][mm][md]) {
                        my = i;
                        mm = j;
                        md = k;
                    }
        pw.print((md < 9 ? "0" : "") + (md + 1) + "-" + (mm < 9 ? "0" : "") + (mm + 1) + "-" + (my + 2013));
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(next());
    }

    String nl() throws IOException {
        return br.readLine();
    }

    PrintWriter pw;
    BufferedReader br;
    StringTokenizer st;

    public static void main(String[] args) throws IOException {
        long timeout = System.currentTimeMillis();
        boolean CF = System.getProperty("ONLINE_JUDGE") != null;
        PrintWriter _pw = new PrintWriter(System.out);
        BufferedReader _br = new BufferedReader(CF ? new InputStreamReader(System.in) : new FileReader(new File("in.txt")));
        new B(_br, _pw).run();
        if (!CF) {
            _pw.println();
            _pw.println(System.currentTimeMillis() - timeout);
        }
        _br.close();
        _pw.close();
    }

    public B(BufferedReader _br, PrintWriter _pw) {
        br = _br;
        pw = _pw;
    }
}
