#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
const double pi = acos(-1.0);
const double eps = 1e-11;
const int MAXI = 0x7fffffff;
int in() {
  int x = 0, c;
  for (; (unsigned)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned)((c = getchar()) - '0') < 10);
  return x;
}
string s;
int y2013[32][13], y2014[32][13], y2015[32][13];
int toNum(int f, int l) {
  int tmp, re;
  tmp = 1;
  re = 0;
  for (int i = l; i >= f; i--) {
    re += (s[i] - '0') * tmp;
    tmp *= 10;
  }
  return re;
}
void solve(int f) {
  if (s[f + 2] == '-' && s[f + 5] == '-') {
    bool flag;
    flag = true;
    for (int i = (0), _b = (10); i < _b; i++)
      if (i != 2 && i != 5 && s[f + i] == '-') {
        flag = false;
        break;
      }
    if (flag) {
      int d, m, y;
      d = toNum(f, f + 1);
      m = toNum(f + 3, f + 4);
      y = toNum(f + 6, f + 9);
      if (d > 0 && d < 32 && m > 0 && m < 13) {
        if (y == 2013) y2013[d][m]++;
        if (y == 2014) y2014[d][m]++;
        if (y == 2015) y2015[d][m]++;
      }
    }
  }
}
int main(int argc, char *argv[]) {
  cin >> s;
  for (int i = 0; i < s.size() - 9; i++) solve(i);
  int imax, dd, mm, yy;
  imax = 0;
  for (int i = (1), _b = (32); i < _b; i++) {
    for (int j = (1), _b = (13); j < _b; j++) {
      if (y2013[i][j] > imax) {
        imax = y2013[i][j];
        dd = i;
        mm = j;
        yy = 2013;
      }
    }
  }
  for (int i = (1), _b = (32); i < _b; i++) {
    for (int j = (1), _b = (13); j < _b; j++) {
      if (y2014[i][j] > imax) {
        imax = y2014[i][j];
        dd = i;
        mm = j;
        yy = 2014;
      }
    }
  }
  for (int i = (1), _b = (32); i < _b; i++) {
    for (int j = (1), _b = (13); j < _b; j++) {
      if (y2015[i][j] > imax) {
        imax = y2015[i][j];
        dd = i;
        mm = j;
        yy = 2015;
      }
    }
  }
  if (dd < 10) cout << '0';
  cout << dd << '-';
  if (mm < 10) cout << '0';
  cout << mm << '-' << yy;
  return 0;
}
