#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define mi map<int,int>
#define pi pair<int,int>
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define deb(x) cout << "X: == " << x << endl;
#define dispMap(a) for(auto it=a.begin() ; it!= a.end() ; it++) {cout << it->first << "  " << it->second << endl; }
#define dispVector(a) for(auto it = a.begin() ; it!= a.end() ;it++) {cout << *it << endl;}
using namespace std;
int main() {
IOS
    string s;
    getline(cin >> ws, s);
    vector<string>a;
    string b = "";
    For(i, 0, s.size()) {
        if(s[i] == '-'){
            if(b.size() > 0) {
                a.pb(b);
                b = "";
            }
        } else {
            b += s[i];
        }
    }
    a.pb(b);
    map<string, int>cnt;
    int condition;
    if(a.size() > 2) {
        condition = a.size();
    } else if(a.size() == 2) {
        condition = 3;
    }
    For(i, 2, condition) {
        if(a[i].size() >= 4) {
            string year = "";
            year += a[i][0]; 
            year += a[i][1];
            year += a[i][2];
            year +=  a[i][3];
            if(stoi(year) >= 2013 && stoi(year) <= 2015) {
                if(a[i-1].size() == 2) {
                    string month = "";
                    month = a[i-1];
                    if(stoi(month) >= 1 && stoi(month) <= 12) {
                        if(a[i-2].size() >= 2) {
                            string day = "";
                            day += a[i-2][a[i-2].size()-2];
                            day += a[i-2][a[i-2].size()-1];
                            if(stoi(month) <= 7) {
                                if(stoi(month) % 2) {
                                    if(stoi(day) <= 31) {
                                        string ans = "";
                                        ans += day + '-' + month + '-' + year;
                                        cnt[ans]++;
                                    } else {
                                        continue;
                                    }
                                } else {
                                    if(stoi(day) <= 30) {
                                        string ans = "";
                                        ans += day + '-' + month + '-' + year;
                                        cnt[ans]++;
                                    } else {
                                        continue;
                                    }
                                }
                            } else {
                                if(stoi(month) % 2) {
                                    if(stoi(day) <= 30) {
                                        string ans = "";
                                        ans += day + '-' + month + '-' + year;
                                        cnt[ans]++;
                                    } else {
                                        continue;
                                    }
                                } else {
                                    if(stoi(day) <= 31) {
                                        string ans = "";
                                        ans += day + '-' + month + '-' + year;
                                        cnt[ans]++;
                                    } else {
                                        continue;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    int ans = 0;
    string an;
    for(auto it = cnt.begin(); it!=cnt.end(); it++) {
        if( it->second > ans) {
            ans = it->second;
            an = it->first;
        }
    }
    cout << an << endl;

}