#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <iomanip>
#include <map>
#include <set> 
#include <sstream>
#include <fstream>
#include <utility>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <time.h>
using namespace std;
#define REP(i,a) for(int i=0;i<a;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define SIZE(c) (int)c.size()
#define ALL(c) (c).begin(),(c).end() 
typedef pair<int, int> PII;
typedef long long LL;
const int INF = 1000000000;
int swaps = 0;
int index = 0;

bool isDayOver(int month, int day){
	if(month == 1 || month == 3 || month == 5 || month == 7|| month == 8
			|| month == 10 || month == 12)
	 return (31-day>=0 && day>0)?true:false; 
	 else if(month == 2)
		return (28-day>=0 && day>0)?true:false; 
	return (30-day>=0 && day>0)?true:false; 
}

bool isYearOver(int year){
	if (year >= 2013 && year<=2015)
		return true;
	return false;
}

bool isMonthOver(int month){
	if (month >= 1 && month<=12)
		return true;
	return false;
}

bool isProperDate(string date){
	string sample = "01-01-2000";
	for(int i=0; i<10; i++)
		if(!(i == '2' || i == '5'))
			sample[i] = date[i];
	for(int i=0; i<10; i++)
		if(sample[i] != date[i])
			return false;
	return true;
}

int main() {
	//freopen("input.in", "r", stdin);
	string prop;
	cin>>prop;
	map<string, int> freq;
	int day, month, year;
	for(int i=0; i<(int)prop.size()-9; i++){
		string temp = prop.substr(i,10);
		stringstream convert(temp.substr(6,4));
		convert >> year;
		stringstream convert2(temp.substr(3,2));
		convert2 >> month;
		stringstream convert3(temp.substr(0,2));
		convert3 >> day;
		if(isProperDate(temp) && isMonthOver(month) && isDayOver(month, day) && isYearOver(year))
			freq[temp]++;
		//cout<<temp<<endl;
	}

    //--- Write the count and the word.
    map<string, int>::const_iterator iter;
    int max = 0;
    string propYear="";
    for (iter=freq.begin(); iter != freq.end(); ++iter) {
       if(iter->second > max){
			max = iter->second;
			propYear = iter->first;
		}
    }
    cout<<propYear;
	
	
	return 0;
}
