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


public class test {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;
    
    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }
    
    boolean check(String s) {
        for(int i=0; i<10; i++) {
            if(s.charAt(i)=='-') {
                if(i!=2 && i!=5) return false;
            }
            if(i==2 || i==5) {
                if(s.charAt(i)!='-') return false;
            }
        }
        String[] t = s.split("-");
        int d = Integer.parseInt(t[0]);
        int m = Integer.parseInt(t[1]);
        int y = Integer.parseInt(t[2]);
        if(d<=0 || d>31) return false;
        if(m<=0 || m>12) return false;
        if(y<=2012 || y>2015) return false;
        int[] c = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if(d>=c[m-1]) return false;
        return true;
    }
    
    void solve(InputReader in, PrintWriter out) throws IOException {
        String s = in.next();
        int n = s.length();
        HashMap<String, Integer> mp = new HashMap<>();
        String rs = "";
        int cn = 0;
        for(int i=0; i<=n-10; i++) {
            String x = s.substring(i, i+10);
            if(!check(x)) continue;
            if(mp.containsKey(x)) {
                mp.put(x, mp.get(x)+1);
            } else {
                mp.put(x, 1);
            }
            if(mp.get(x)>cn) {
                rs = x;
                cn = mp.get(x);
            }
        }
        out.println(rs);
    }
    
    
    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
        
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}