#include <bits/stdc++.h>
using namespace std;
char s[101111];
int md[] = {31, 30, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, cnt[33][13][5];
bool input() { gets(s); }
void solve() {
  int len = strlen(s), res = 0;
  memset(cnt, 0, sizeof(cnt));
  for (char *ps = s; ps[10] != 0; ps++) {
    if (ps[2] != '-' || ps[5] != '-') continue;
    if (ps[0] == '-' || ps[1] == '-' || ps[3] == '-' || ps[4] == '-' ||
        ps[6] == '-' || ps[7] == '-' || ps[8] == '-' || ps[9] == '-')
      continue;
    int d = (ps[0] - '0') * 10 + ps[1] - '0',
        m = (ps[3] - '0') * 10 + ps[4] - '0',
        y = (ps[6] - '0') * 1000 + (ps[7] - '0') * 100 + (ps[8] - '0') * 10 +
            ps[9] - '0';
    if (12 < m) continue;
    if (md[m - 1] < d || d < 1) continue;
    if (y < 2013 || 2015 < y) continue;
    cnt[d - 1][m - 1][y - 2013]++;
  }
  int resd = 0, resm = 0, resy = 0;
  for (int d = 0; d < 32; d++)
    for (int m = 0; m < 12; m++)
      for (int y = 0; y < 3; y++)
        if (cnt[resd][resm][resy] < cnt[d][m][y]) {
          resd = d;
          resm = m;
          resy = y;
        }
  if (resd + 1 < 10) printf("0");
  printf("%d-", resd + 1);
  if (resm + 1 < 10) printf("0");
  printf("%d-", resm + 1);
  printf("%d\n", resy + 2013);
}
int main() {
  input();
  solve();
  return 0;
}
