#include <bits/stdc++.h>
char a[100000 + 2];
int vis[32][13][6];
int save[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
void solve() {
  memset(vis, 0, sizeof(vis));
  int len = strlen(a);
  int max = 0, d, m, y;
  for (int i = 9; i < len; i++) {
    if ((a[i] == '3' || a[i] == '4' || a[i] == '5') && a[i - 1] == '1' &&
        a[i - 2] == '0' && a[i - 3] == '2') {
      if (a[i - 4] != '-' || a[i - 7] != '-' || a[i - 5] == '-' ||
          a[i - 6] == '-' || a[i - 8] == '-' || a[i - 9] == '-')
        continue;
      int dd = (a[i - 9] - '0') * 10 + (a[i - 8] - '0');
      int mm = (a[i - 6] - '0') * 10 + (a[i - 5] - '0');
      if (mm <= 12 && mm > 0 && dd > 0 && dd <= save[mm - 1]) {
        int k = ++vis[dd][mm][a[i] - '0'];
        if (k > max) {
          max = k;
          d = dd;
          m = mm;
          y = 2010 + a[i] - '0';
        }
      }
    }
  }
  if (d < 10) printf("0");
  printf("%d-", d);
  if (m < 10) printf("0");
  printf("%d-%d\n", m, y);
}
int main() {
  while (gets(a)) {
    solve();
  }
  return 0;
}
