#include<iostream> 
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<climits>
#include<algorithm>
#include<cctype>
using namespace std;
int d1,d2,d3;
int m1,m2,m3;
int nows;
int hash[2000000];
char fs[2000000];
int month[13]=
{
	-1,31,30,31,30,31,30,31,31,30,31,30,31
};
void calc(int d1,int d2,int d3){
	//cout<<d1<<" "<<d2<<" "<<d3<<endl;
	if (d3<2013) return; 
	if (d3>2015) return; 
	if (d2<1) return;
	if (d2>12) return;
	if (d1<1) return;
	if (d1>month[d2])return;
	hash[d1*1000+d2*10+(d3-2013)]++;
}
void doit(int d1,int d2,int d3){
	int jj;
	for (jj=1;jj<=d3;jj*=10);
	for (int i=1;(i/10)<=d1;i*=10){
		for (int j=jj/10;j>0;j/=10){
			calc(d1%i,d2,d3/j);
		}
	}
}
int main(void){
	int i;
	gets(fs);d1=-1;d2=-1;d3=-1; 
	for (i=0;fs[i];i++){
		if (isdigit(fs[i]) ){
			if (nows==-1) nows=0;
			nows*=10;
			nows+=fs[i]-'0';
		}
		else if (nows!=-1){
			 
			//cout<<d1<<" "<<d2<<" "<<d3<<endl;
			d1=d2;d2=d3;d3=nows;nows=-1;
			if (d1!=-1) doit(d1,d2,d3);
		}
	}
	d1=d2;d2=d3;d3=nows;nows=0;
	if (d1!=-1) doit(d1,d2,d3);
	int f=0,k=-1;
	for (i=0;i<2000000;i++){
		if (hash[i]>f){
			f=hash[i];
			k=i;
		}
	}
	printf("%d-",k/1000);
	k%=1000;
	printf("%d-",k/10);
	k%=10;
	printf("%d\n",k+2013);
	//system("pause");
}
