#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcount(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

string str, tmp;
int n;
map<string, int> M;

int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

// dd-mm-yyyy
bool ok() {
   if (CV(tmp,'-') != 2 || tmp[2] != '-' || tmp[5] != '-')
      return 0;
   int d = (tmp[0] - '0') * 10 + (tmp[1] - '0');
   int m = (tmp[3] - '0') * 10 + (tmp[4] - '0');
   int y = (tmp[6] - '0') * 1000 + (tmp[7] - '0') * 100 + (tmp[8] - '0') * 10
         + (tmp[9] - '0');
   return (m <= 12 && d <= days[m - 1] && y >= 2013 && y <= 2015);
}

int main() {
   std::ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
#ifndef ONLINE_JUDGE
// freopen("in.txt","rt",stdin);
// freopen("out.txt","wt",stdout);
#endif
   cin >> str;
   n = SZ(str);
   for (int i = 0; i <= n - 10; i++) {
      tmp = "";
      for (int j = 0; j < 10; j++)
         tmp += str[i + j];
      if (ok())
         M[tmp]++;
   }
   int mx = 0;
   string res;
   foreach(it,M)
      if (it->second > mx)
         mx = it->second, res = it->first;
   cout << res << endl;
   return 0;
}
