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

public class B {
	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

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

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}
	
	boolean c (char c) {
		return (c >= '0' && c <= '9');
	}

	void solve() throws IOException {
		String s = nextLine();
		String st = "";
		int max = 0;
		String ans = "";
		HashMap<String, Integer> map = new HashMap<>();
		for (int i = 0; i < s.length() - 9; i++) {
			st = "";
			for (int j = 0; j < 10; j++) {
				st += s.charAt(i + j);
			}
			boolean f = false;
			
				if (!c(st.charAt(0)) || !c(st.charAt(1)) || !c(st.charAt(3)) || !c(st.charAt(4)) || !c(st.charAt(6))||!c(st.charAt(7))||!c(st.charAt(8))||!c(st.charAt(9))) {
					f = true;
				}
				if (st.charAt(2) != '-' || st.charAt(5) != '-') f = true;
			if (f) continue;
			String sd = "";
			String sm = "";
			String sy = "";
			sd += st.charAt(0);
			sd += st.charAt(1);
			sm += st.charAt(3);
			sm += st.charAt(4);
			sy += st.charAt(6);
			sy += st.charAt(7);
			sy += st.charAt(8);
			sy += st.charAt(9);
			int d = Integer.parseInt(sd);
			int m = Integer.parseInt(sm);
			int y = Integer.parseInt(sy);
			if (y > 2015 || y < 2013) continue;
			if (m < 1 || m > 12) continue;
			if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
				if (d > 31) continue;
			}
			if (m == 4 || m == 6 || m == 9 || m == 11) {
				if (d > 30) continue;
			}if (m == 2) {
				if (d > 28) continue;
			}
			if (map.containsKey(st)) {
				int q = map.get(st);
				map.remove(st);
				map.put(st, q + 1);
				if (q + 1 > max) {
					max = q + 1;
					ans = st;
				}
			} else {
				map.put(st, 1);
				if (1 > max) {
					max = 1;
					ans = st;
				}
			}
		}
		out.println(ans);
	}

	void run() throws IOException {
		//br = new BufferedReader(new FileReader("B.in"));
		//out = new PrintWriter("B.in");
		 br = new BufferedReader(new InputStreamReader(System.in));
		 out = new PrintWriter(System.out);
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		// Localea.setDefault(Locale.US);
		new B().run();
	}
}