#include <bits/stdc++.h>
char s[100020];
int c[5][15][35];
int mo[15] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int i, j, n;
  int m, y, d, max = 0;
  int am, ay, ad;
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < n; i++)
    if (s[i + 2] == '-' && s[i + 5] == '-')
      if (s[i + 6] == '2' && s[i + 7] == '0' && s[i + 8] == '1') {
        if (s[i] == '-' || s[i + 1] == '-' || s[i + 3] == '-' ||
            s[i + 4] == '-')
          continue;
        y = s[i + 9] - 3 - '0';
        if (y > 2) continue;
        d = (s[i] - '0') * 10 + s[i + 1] - '0';
        m = (s[i + 3] - '0') * 10 + s[i + 4] - '0';
        if (m > 13 || d > mo[m] || m == 0 || d == 0) continue;
        c[y][m][d]++;
        if (c[y][m][d] > max) {
          max = c[y][m][d];
          am = m;
          ay = y;
          ad = d;
        }
      }
  ay += 2013;
  printf("%d-%d-%d\n", ad, am, ay);
  return 0;
}
