#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define ll long long
#define ld long double
#define al 0x3F3F3F3F
#define ull unsigned long long
#define PI pair < int, int > 
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
#define resize(v) v.resize(unique(all(v)) - v.begin());
//#define int ll

const int mod = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 123;
const int N = 1e6 + 123;
const int INF = al;
const ll INFL = 8e18 + 1;
const double pi = acos(-1.0);
const double eps = 1e-9;

int m[13]; 
set <string> ss;
map <string, int> q;          

inline int gcd(int a, int b) {
	if (!b) return a;
	gcd(b, a % b);
}                                                 

inline void boost() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
}   
 
inline void Solve() {	
    boost();
    string s;
    cin >> s;
    m[1] = 31, m[2] = 30, m[3] = 31, m[4] = 30, m[5] = 31, m[6] = 30, m[7] = 31, m[8] = 31, m[9] = 30, m[10] = 31, m[11] = 30, m[12] = 31;
    for (int i = 0; i < sz(s) - 9; i++) {
    	string cur = s.substr(i, 10);
    	if (cur[2] != '-' || cur[5] != '-') continue; 
    	int dd = (cur[0] - '0') * 10 + cur[1] - '0';
    	int mm = (cur[3] - '0') * 10 + cur[4]; 
    	if (dd < 1 && dd > m[mm]) continue;
    	int yy = (cur[6] - '0') * 1000 + (cur[7] - '0') * 100 + (cur[8] - '0') * 10 + (cur[9] - '0');
    	if (yy < 2013 && yy > 2015) continue;
    	ss.in(cur);
    	q[cur]++;
    }              
    int maxi = 0;
    string ans = "";
    for (auto to : ss) 
    	if (maxi < q[to])
    		maxi = q[to], ans = to;
    cout << ans;

}            

main () {
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	int tt = 1;
	while (tt--) {
		Solve();
	}
}                           
    