#include <bits/stdc++.h>
using namespace std;
char s[100005];
int day[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int cnt[35][15][5];
int ay, gun, sene, Max, yi, yj, yt;
int main() {
  scanf(" %s", s);
  int uz = strlen(s);
  for (int i = 0; i < uz - 10; i++) {
    if (s[i] < '0' || s[i] > '9') continue;
    if (s[i + 1] < '0' || s[i + 1] > '9') continue;
    if (s[i + 2] != '-') continue;
    if (s[i + 3] < '0' || s[i] > '9') continue;
    if (s[i + 4] < '0' || s[i + 1] > '9') continue;
    if (s[i + 5] != '-') continue;
    if (s[i + 6] < '0' || s[i] > '9') continue;
    if (s[i + 7] < '0' || s[i + 1] > '9') continue;
    if (s[i + 8] < '0' || s[i] > '9') continue;
    if (s[i + 9] < '0' || s[i + 1] > '9') continue;
    ay = (s[i + 3] - '0') * 10 + s[i + 4] - '0';
    if (ay < 1 || ay > 12) continue;
    gun = (s[i] - '0') * 10 + s[i + 1] - '0';
    if (gun > day[ay]) continue;
    sene = (s[i + 6] - '0') * 1000 + (s[i + 7] - '0') * 100 +
           (s[i + 8] - '0') * 10 + (s[i + 9] - '0');
    if (sene < 2013 || sene > 2015) continue;
    cnt[gun][ay][sene - 2013]++;
  }
  for (int i = 0; i < 31; i++)
    for (int j = 1; j <= 12; j++)
      for (int t = 0; t < 3; t++) {
        if (Max < cnt[i][j][t]) {
          yi = i;
          yj = j;
          yt = t;
          Max = cnt[i][j][t];
        }
      }
  printf("%d-%d-%d\n", yi, yj, yt + 2013);
}
