import java.io.*;
import java.security.SecureRandom;
import java.util.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {
    
    
	int d[] = {31,28,31,30,31,30,31,31,30,31,30,31};
	
	boolean check(char c) {
		return (c - '0') >= 0 && (c - '0') <= 9;
	}
	
	public void solve() throws Exception {
		char seq[] = sc.nextToken().toCharArray();
		TreeMap<String, Integer> map = new TreeMap<>();
		int n = seq.length;
		for (int i = 0;i < n - 9; ++ i) {
			if (check(seq[i]) && check(seq[i+1]) && check(seq[i+3]) && check(seq[i+4]) &&
					check(seq[i+6]) && check(seq[i+7]) && check(seq[i+8]) && check(seq[i+9])
					&& seq[i+2] == '-' && seq[i+5] == '-') {
				int dd = (seq[i] - '0') * 10 + seq[i+1] - '0';
				int mm = (seq[i+3] - '0') * 10 + seq[i+4] - '0';
				int yy = (seq[i+6] - '0') * 10 + seq[i+7] - '0';
				yy = yy * 100 + (seq[i+8] - '0') * 10 + (seq[i+9] - '0');
				if (mm >= 1 && mm <= 12 && dd >= 1 && dd <= d[mm-1] && yy >= 2013 && yy <= 2015) {
					String s = dd + "-" + mm + "-" + yy;
					if (map.containsKey(s)) {
						int c = map.get(s);
						map.remove(s);
						map.put(s, c+1);
					} else {
						map.put(s, 1);
					}
				}
			}
		}
		String ans = "";
		int cnt = 0;
		for (String s : map.keySet()) {
			if (cnt < map.get(s)) {
				cnt = map.get(s);
				ans = s;
			}
		}
		
		out.println(ans);
    }
    
    
    
    
    /*--------------------------------------------------------------*/
    
    static String filename = "";
    static boolean fromFile = false;
    
    BufferedReader in;
    PrintWriter out;
    FastScanner sc;
    
    public static void main(String[] args) {
        new Thread(null, new Solution(), "", 1 << 25).start();
    }
   
    public void run() {
        try {
            init();
            solve();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            out.close();
        }
    }
    
    void init() throws Exception {
    	if (fromFile) {
    		in = new BufferedReader(new FileReader(filename+".in"));
        	out = new PrintWriter(new FileWriter(filename+".out"));
    	} else {
    		in = new BufferedReader(new InputStreamReader(System.in));
        	out = new PrintWriter(System.out);
    	}
        sc = new FastScanner(in);
    }
}

class FastScanner {
    
    BufferedReader reader;
    StringTokenizer strTok;
    
    public FastScanner(BufferedReader reader) {
        this.reader = reader;
    }
    
    public String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            strTok = new StringTokenizer(reader.readLine());
        }
        
        return strTok.nextToken();
    }
    
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    
    public BigInteger nextBigInteger() throws IOException {
    	return new BigInteger(nextToken());
    }
    
    public BigDecimal nextBigDecimal() throws IOException {
    	return new BigDecimal(nextToken());
    }
}