/* PROBLEM=260_A; rm "${PROBLEM}"; make "${PROBLEM}" CPPFLAGS=-DONLINE_JUDGE; ./"${PROBLEM}" < input */
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fcntl.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unistd.h>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#include <utility>
#include <vector>

using namespace std;

#ifndef ONLINE_JUDGE
	#define DEBUG
#endif

#define INF (1LL<<32)
#define LINF (long long) (1E18)
#define NINF (-1*1E9)
#define EPS (1E-9)
#define MOD (1E9+9)
#define RAND ((rand()<<15)+rand())

#define FO(i,s,e,p)  for(int i=(s);i<(e);i+=p)
#define FOD(i,s,e,p) for(int i=(s);i>(e);i-=p)
#define FOR(i,a,b)   for(int(i)=int(a);(i)<int(b);(i)++)
#define FOREQ(i,a,b) for(int(i)=int(a);(i)<=int(b);(i)++)
#define RFOR(i,a,b)  for(int(i)=(a),_b(b);(i)>=_b;--(i))
#define REP(i,n)     FOR((i),0,(n))
#define FOREACH(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define TR(c,itr)    for (typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++)

#define present(c,x)  ((c).find(x) != (c).end())    // SET/MAP
#define cpresent(c,x) (find(all(c),x) != (c).end())

#define ABS(x)   ((x)<0?-(x):(x))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define SQR(a)   ((a)*(a))
#define SUM(a)   accumulate(all(a),string())

#define FILL(arr,val) memset((arr),(val),sizeof(arr))
#define CLR(a)        memset((a),0,sizeof(a))
#define CPY(dest,src) memcpy((dest),(src),sizeof(dest))

#define ALL(a)       (a).begin(),(a).end()
#define SZ(a)        ((int)(a).size())
#define UNIQ(a)      sort(all(a)); (a).erase(unique(all(a)),(a).end())
#define IDX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())

#define fst first
#define snd second
#define X   first
#define Y   second
#define pb  push_back
#define mp  make_pair
#define tri(a,b,c) mp(a,mp(b,c))

#define LOG(a) (cerr<<__LINE__<<": "#a" = "<<(a)<<endl)
#define DBG(...) (__VA_ARGS__)
#define debug(args...) {dbg,args; cerr<<endl;}
#define dline cerr<<endl
struct debugger
{
 template<typename T> debugger& operator , (const T& v)
 {
  cerr<<v<<" ";
  return *this;
 }
} dbg;
#define oo 0x3F3F3F3F
#ifdef DEBUG
	#define cvar(x) cerr << "<" << #x << ": " << x << ">"
	#define evar(x) cvar (x) << endl
	template<class T> void DISP(const char *s, T x, int n) {cerr << "[" << s << ": "; FOR(i,0,n) cerr << x[i] << " "; cerr << "]" << endl;}
	#define disp(x,n) DISP(#x " to " #n, x, n)
#else
	#define cvar(...) ({})
	#define evar(...) ({})
	#define disp(...) ({})
#endif

typedef long long LL;
typedef unsigned long long ULL;
typedef long long int64;
typedef unsigned long long uint64;
typedef unsigned int uint;
typedef long double real;

typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef pair<int,double> PID;
typedef pair<LL,LL> PLL;
typedef pair<int,PII> TRI;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<PID> VID;
typedef vector<PLL> VLL;
typedef vector<TRI> VT;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VII> VVII;
typedef vector<VLL> VVLL;
typedef vector<VT> VVT;

typedef complex<double> pt;
typedef complex<LL> pti;

const double PI = acos(-1);

template<class T> inline T sqr(T x)      {return x * x;}
template<class T> inline T min(T a, T b) {return (a<b)?a:b;}
template<class T> inline T max(T a, T b) {return (a>b)?a:b;}
template<class T> inline bool chkmin(T &a, T b) {return a > b ? a = b, true : false;}
template<class T> inline bool chkmax(T &a, T b) {return a < b ? a = b, true : false;}
//template<class T> T gcd(T a, T b) { return b?gcd(b,a%b):a; }
template <typename T> T gcd(T x, T y) {for (T t; x; t = x, x = y % x, y = t); return y; }
int64 pow(int64 b, int64 e, int64 m) { int64 t = 1; for (; e; e >>= 1, b = b * b % m) e & 1 ? t = t * b % m : 0; return t; }
bool is_prime(int m) {
	int u=sqrt(m);
	for (int i=2; i<=u+1; i++)
	{
		if (m%i==0)
		{
			return false;
		}
	}
	return true;
}

template<class edge> struct Graph
{
	vector<vector<edge> > adj;
	Graph(int n) {adj.clear (); adj.resize (n + 5);}
	Graph() {adj.clear (); }
	void resize(int n) {adj.resize (n + 5); }
	void add(int s, edge e){adj[s].push_back (e);}
	void del(int s, edge e) {adj[s].erase (find (iter (adj[s]), e)); }
	vector<edge>& operator [](int t) {return adj[t];}
};

struct Point
{
	int X,Y;
};
bool operator <(Point A,Point B)
{
	return (A.X==B.X)?(A.Y<B.Y):(A.X<B.X);
}

/** C++ Strings
	- substr([start,end])
	- empty()
	- length() **UNSIGNED**
	const string& s;
	istringstream is(s);
	int tmp;
	is >> tmp;

	int tmp;
	ostringstream os;
	os << tmp;
	string s = os.str();
*/

#ifndef ONLINE_JUDGE
	void compare(int test_number, stringstream& input, stringstream& output,
	 stringstream& solution)
	{
		if (solution.str() != output.str())
		{
			cout << "Test #" << test_number << ": " << input.str() << endl
				 << "    Expected: #" << solution.str() << "#" << endl
				 << "    Received: #" << output.str() << "#" << endl;
		}
	}
#endif

#define ASSERT(x,var) \
	if (!(x)) \
	{ \
		cout << "ERROR!! Assert " << #x << " failed" << endl \
			 << " value = " << var << endl \
			 << " on line " << __LINE__  << endl \
			 << " in file " << __FILE__ << endl;  \
		exit(1); \
	}

template<class T>
bool pairCompare(const T & x, const T & y)
{
  return x.second < y.second;
}

template<class T>
typename T::const_iterator map_max_element(const T &A)
{
    typedef typename T::value_type pair_type;
    return max_element(A.begin(), A.end(), pairCompare<typename T::value_type>);
}

///////////////////////////////////////////////////////
/** <algorithm>
	- swap(a,b)
	- sort([r]begin,[r]end): asc/desc
	- find(begin,end,elem)
	- count(begin,end,elem)
	- {prev,next}_permutation(begin,end) **SORTED**
	- reverse(begin,end)
	- {min,max}_element(all(v)) - v.begin()
*/

// <vector>: vector< vector<int> > Matrix(N, vector<int>(M, -1));
// <set>: s.erase(s.find(10), s.find(100)); -> erase [10,100)
// <map>: use find() in loops, instead of operator[]
//        operator[] inserts new element with key if not found

/* set with elements in descending order */
//set<pair<int,int>, greater<pair<int,int> > > s;
///////////////////////////////////////////////////////
/**
void some_function(const vector<int>& v) {
   // …
}

void modify_vector(vector<int>& v) {
//   v[0]++;
}
*/
///////////////////////////////////////////////////////
char s[(int)1E5+5];
map<string,int> lookup;
map<string,int>::const_iterator itr;

inline bool calc(int start)
{
//	printf("start: %d; s(#%d)\n", start, strlen(s));
	if (start<0 || start>=strlen(s)) return false;

	char date[11]; // strlen("dd-mm-yyyy")+1
	memcpy(date,s+start,10);
	date[10] = '\0';
//	printf("date: %s\n", date);

	if (date[2]=='-' && date[5]=='-') {}
	else return false;
//	printf("dashes passed\n");

	if (date[6]=='2' && date[7]=='0' && date[8]=='1' &&
		(date[9]=='3'||date[9]=='4'||date[9]=='5')) {}
	else return false;
//	printf("year passed\n");

	if ('0'<=date[3]<='1' && '0'<=date[4]<='9') {}
	else return false;
	// ASCII values of the digits 1-9 are off by 48
	// '0'=48; '9'=57, eg. '1'->1: -48
	int month = 10*(date[3]-48)+(date[4]-48);
//	printf("month: %d\n", month);
	if (1<=month && month<=12) {}
	else return false;

	if ('0'<=date[0]<='3' && '0'<=date[1]<='9') {}
	else return false;
	int day = 10*(date[0]-48)+(date[1]-48);
//	printf("day: %d\n", day);
	if (month==4 || month==6 || month==9 || month==11)
	{
		if (day<=30) {} else return false;
	}
	else if (month==2)
	{
		/*
		bool is_leap_year = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
		if (is_leap_year)
			days = 29;
		else
			days = 28;
		*/

		// not leap year
		if (day<=28) {} else return false; 
	}
	else
	{
		if (day<=31) {} else return false;
	}

	string str(date, find(date, date+strlen(date), '\0'));
//	cout << "date: " << str << endl;
	lookup[str]++;
	return true;
}

int main(int argc, char** argv)
{
//	ios_base::sync_with_stdio(false);
	scanf("%s", s);
//	printf("%s\n", s);
	
	int len = strlen(s);
	int offset = strlen("dd-mm-yyyy");
	FOR(i,0,len)
	{
		if (s[i] == '-')
		{
			if (calc(i-2))
			{
				i=i-2+offset-1;
			}
		}
	}

	itr = map_max_element(lookup);
	printf("%s", itr->fst.c_str());//, itr->snd);
/*
	stringstream input;
	input << "260 150 10";
	stringstream solution;
	solution << "-1";
	stringstream output;
	TheSolution(input, output);
	compare(0, output, solution);
*/
    return 0;
}
