#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = acos(-1.0);
const long double eps = 1e-9;
const int dX[] = {-1, 1, 0, 0, -1, 1, -1, 1};
const int dY[] = {0, 0, -1, 1, 1, -1, -1, 1};
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& a) {
  o << a.first << " " << a.second;
  return o;
}
template <class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& a) {
  for (typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
    o << (*it) << "\n";
  return o;
}
template <class S>
ostream& operator<<(ostream& o, const vector<S>& a) {
  for (typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
    o << *it << " ";
  return o;
}
template <class S>
ostream& operator<<(ostream& o, const vector<vector<S> >& a) {
  for (typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) {
    o << (*it) << "\n";
  }
  return o;
}
template <class S>
ostream& operator<<(ostream& o, const set<S>& a) {
  for (typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
    o << *it << " ";
  return o;
}
const long long MAX = 30;
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int cnt[MAX][MAX][MAX];
int main() {
  int i, j, d, m, y, max_cnt = 0, bd, bm, by;
  bool f;
  string s;
  cin >> s;
  for (i = (0); (((1) > 0) - ((1) < 0)) * i <
                (((1) > 0) - ((1) < 0)) * (((long long)(s).size()) - 9);
       i += (1)) {
    if (s[i + 2] != '-' || s[i + 5] != '-') continue;
    f = 1;
    for (j = (0); (((1) > 0) - ((1) < 0)) * j < (((1) > 0) - ((1) < 0)) * (10);
         j += (1)) {
      if (i != 2 && i != 5 && s[i + j] == '-') f = 0;
    }
    if (!f) continue;
    d = (s[i] - '0') * 10 + (s[i + 1] - '0');
    m = (s[i + 3] - '0') * 10 + (s[i + 4] - '0');
    y = (s[i + 6] - '0') * 1000 + (s[i + 7] - '0') * 100 +
        (s[i + 8] - '0') * 10 + (s[i + 9] - '0');
    if (y < 2013 || y > 2015) continue;
    if (m < 1 || m > 12) continue;
    if (d < 1 || d > days[m - 1]) continue;
    cnt[d][m][y - 2013]++;
    if (cnt[d][m][y - 2013] > max_cnt) {
      max_cnt = cnt[d][m][y - 2013];
      bd = d, bm = m, by = y;
    }
  }
  cout << bd / 10 << bd % 10 << "-" << bm / 10 << bm % 10 << "-" << by;
  return 0;
}
