#include<stdio.h>
#include<math.h>
#include<time.h>
#include<string.h>
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int hash[34][13][7];
char str[1000050];
int main()
{
    int i,j,k,a,b,n,day,month,years,md,mm,my,maxx=-1;
    gets(str);
    memset(hash,0,sizeof(hash));
    int len=strlen(str);
    for(i=0;i<len-9;++i)
    {
        //dd-mm-yyyy
        if(str[i]>='0'&&str[i]<='3'&&
           str[i+1]<='9'&&str[i+1]>='0'&&
           str[i+2]=='-'&&
           str[i+3]<='1'&&str[i+3]>='0'&&
           str[i+4]<='2'&&str[i+4]>='0'&&
           str[i+5]=='-'&&
           str[i+6]=='2'&&
           str[i+7]=='0'&&
           str[i+8]=='1'&&
           str[i+9]<='5'&&str[i+9]>='3')
       {
           day=(str[i]-'0')*10+str[i+1]-'0';
           month=(str[i+3]-'0')*10+str[i+4]-'0';
           years=str[i+9]-'0';
           if(day<=0||day>days[month])continue;
           hash[day][month][years]++;
           i+=2;
       }
       else if(
           str[i]<='9'&&str[i+1]>='0'&&
           str[i+1]=='-'&&
           str[i+2]<='1'&&str[i+2]>='0'&&
           str[i+3]<='2'&&str[i+3]>='0'&&
           str[i+4]=='-'&&
           str[i+5]=='2'&&
           str[i+6]=='0'&&
           str[i+7]=='1'&&
           str[i+8]<='5'&&str[i+8]>='3')
       {
           day=(str[i]-'0')*10+str[i+1]-'0';
           month=(str[i+3]-'0')*10+str[i+4]-'0';
           years=str[i+9]-'0';
           if(day<=0||day>days[month])continue;
           hash[day][month][years]++;
           i++;
       }
    }
    for(i=3;i<=5;++i)
    {
        for(j=1;j<=12;++j)
        {
            for(k=1;k<=days[j];++k)
            {
                if(hash[k][j][i])printf("%d %02d %02d  %d\n",i,j,k,hash[k][j][i]);
                if(hash[k][j][i]>=maxx)
                {
                    maxx=hash[k][j][i];
                    my=i;
                    mm=j;
                    md=k;
                }
            }
        }
    }
    printf("%02d-%02d-201%d",md,mm,my);


    return 0;
}
