#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<limits.h>
#include<map>

using namespace std;

string s = "";
map<string,int> m;

int check(int index)
{
	string t = s.substr(index,10);
	int flag = 1;
	if(t[0] >= '0' && t[0] <= '9' && t[1] >= '0' && t[1] <= '9' && t[2] == '-' && t[3] >= '0' && t[3] <= '9' && t[4] >= '0' && t[4] <= '9' && t[5] == '-' && t[6] >= '0' && t[6] <= '9' && t[7] >= '0' && t[7] <='9' && t[8] >= '0' && t[8] <= '9' && t[9] >= '0' && t[9] <= '9')
	{
		flag = 0;
	}
	if(flag == 1)
		return -1;
	else
		return 0;
}

int validate(int i)
{
	string t = s.substr(i,10);
	int date,month,year;
	date = (t[0]-48)*10+(t[1]-48);
	month = (t[3]-48)*10 + (t[4]-48);
	year = (t[6]-48)*1000 + (t[7]-48)*100 + (t[8]-48)*10 + (t[9]-48);
//	cout << date << " " << month << " " << year << endl;
	if(year < 2013 || year > 2015)
		return -1;
	if(month < 1 || month > 12)
		return -1;
	if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
		if(date < 1 || date > 31)
			return -1;
	else if(month == 2)
	{
		if(date < 1 || date > 28)
			return -1;
	}
	else
		if(date < 1 || date > 30)
			return -1;
//	cout << t << endl;
	m[t]++;
	return 0;
}

int main()
{
	cin >> s;
	m.clear();
	int len = s.size();
	for(int i=0;i<len-9;i++)
	{
		if(check(i) == -1)
			continue;
//		cout << check(i) << endl;
		if(validate(i) == -1)
			continue;
//		cout << validate(i) << endl;
	}
	int max = INT_MIN;
	string ans = "";
	map<string,int>::iterator it;

	for(it = m.begin();it != m.end();it++)
		if((*it).second > max)
		{
//			cout << "goes in" << endl;
			max = (*it).second;
			ans = (*it).first;
		}
	cout << max << endl;
	cout << ans << endl;
	return 0;
}
