#include<bits/stdc++.h>
using namespace std;
#define M (int)1e9
#define pi 3.1415926536
#define double long double
vector <int> SieveOfEratosthenes(int n) 
{ 
    vector<int> ans;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    if (prime[p] == true) 
    for (int i=p*p; i<=n; i += p) 
    prime[i] = false; 
        
  	for (int p=2; p<=n; p++) 
    if (prime[p]) 
    ans.push_back(p);
	return ans;
}
 
vector <int> fib(int n)
{
	vector<int> ans;
	int x=0,y=1,l=1;
	ans.push_back(x);
	ans.push_back(y);
	while(l<n)
	{
		l=x+y;
		x=y;y=l;
		ans.push_back(l);
	}
	return ans;
}
 
bool isPrime(int n) 
{ 
	if (n <= 1) return false; 
	if (n <= 3) return true; 
 
	if (n%2 == 0 || n%3 == 0) return false; 
 
	for (int i=5; i*i<=n; i=i+6) 
		if (n%i == 0 || n%(i+2) == 0) 
		return false; 
 
	return true; 
} 
 
 
long long power(int n,int k)
{
	if(k==0)	return 1;
	else return n*power(n,k-1);
}
 
int sdigit(long long x)
{
	int ans=0;
	while(x)
	{
		ans+=x%10;
		x/=10;
	}
	return ans;
}
 
long long lcm(int a,int b)
{
	return ((long long)a*(long long)b)/__gcd(a,b);
}
 
 
pair<int,int> subArraySum(int arr[], int n, int sum) 
{ 
    int curr_sum = arr[0], start = 0, i; 
  
    for (i = 1; i <= n; i++) 
    { 
        while (curr_sum > sum && start < i - 1) 
        { 
            curr_sum = curr_sum - arr[start]; 
            start++; 
        } 
  
        
        if (curr_sum == sum) 
        {  
            return make_pair(start,i-1); 
        } 
  
        if (i < n) 
        curr_sum = curr_sum + arr[i]; 
    } 
  
    return make_pair(-1,-1); 
} 

int bs(int a[],int b,int l,int r)
{
	int mid=(l+r)/2;
	if(l>r)	return -1;
	if(a[mid]==b||l==r)	return mid;
	if(a[mid]>b)	return bs(a,b,l,mid-1);
	else return bs(a,b,mid+1,r);
}
long long nCr(int n, int k)  
{  
    long long res = 1;  
  	if(k>n-k) k = n - k;  
  	for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);
        
    }  
  
    return res;  
}  


void dfs(bool a[],vector<vector <int> >adj,int u)
{
	if(a[u-1])	return;
	else	a[u-1]=true;
	for(int i=0;i<adj[u-1].size();i++)
	{
		dfs(a,adj,adj[u-1][i]);
	}
}

int ed(string a,string b)
{
	int l=a.size(),m=b.size();
	int s[l+1][m+1];
	memset(s,0,sizeof(s));
	for(int j=0;j<=m;j++)
	for(int i=0;i<=l;i++)
	{
	    if(i==0)
	    {
	        if(j)   s[i][j]=s[i][j-1]+1;
	    }
	    else if(j==0)
	    {
	        s[i][j]=s[i-1][j]+1;
	    }
	    else
	    {
	        s[i][j]=min(s[i-1][j]+1,min(s[i][j-1]+1,s[i-1][j-1]+(a[i-1]!=b[j-1])));
	    }
	}
	return s[l][m];
}
int solve(int a[],int id,int n,int W,vector<vector <int> > mw)
{
	if(id==n)	return 0;
	if(mw[W][id]!=0)	return mw[W][id];
	int ans[n-id];
	for(int i=id;i<n;i++)
	{
		//cout<<id<<" "<<i<<" "<<W<<" "<<a[i]<<endl;
		ans[i-id]=solve(a,i+1,n,W,mw);
		if(W>=a[i])
		ans[i-id]=max(solve(a,i+1,n,W-a[i],mw)+a[i],ans[i-id]);
	}
	mw[W][id]=*max_element(ans,ans+(n-id));
	return *max_element(ans,ans+(n-id));
}
int caln(int c,vector<vector<int> > adj,int parent)
{
	if(adj[c-1].size()==1)	return 1;
	int ans=1;
	for(int i=0;i<adj[c-1].size();i++)
	{
		if(adj[c-1][i]==parent)	continue;
		ans+=caln(adj[c-1][i],adj,c);
	}
	return ans;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("inpu.txt","r",stdin);
	freopen("pat.txt","w",stdout);
	#endif
	string s;
	cin>>s;
	int n=s.size(),nd[]={31,28,31,30,31,30,31,31,30,31,30,31};
	map<string,int> f;
	for(int i=6;i<n-3;i++)
	{
		string y=s.substr(i,4);
		//cout<<y<<endl;
		if(y!="2013"&&y!="2014"&&y!="2015")	continue;
		string m=s.substr(i-3,2);
		//cout<<m<<endl;
		if(m<"01"||m>"12"||m=="0-"||m=="1-")	continue;
		int mo=stoi(m);
		//cout<<mo<<endl;
		string d=s.substr(i-6,2);
		if(d<"01"||d>"31"||d=="0-"||d=="1-")	continue;
		int da=stoi(d);
		if(da>nd[mo-1])	continue;
		else
		{
			string date=d+"-"+m+"-"+y;
			if(f.count(date))
				f[date]++;
			else f.insert(make_pair(date,1));
		}
	}
	string ans;
	int ma=0;
	for(map<string,int>:: iterator i=f.begin();i!=f.end();i++)
	{
		if((i->second)>ma)	{ans=(i->first);ma=(i->second);}
	}
	cout<<ans;
	return 0;
}