#include <bits/stdc++.h>
using namespace std;
map<int, int> ma;
int dd[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char str[100000];
int main() {
  int maxi = -1, maxik = -1;
  scanf("%s", &str);
  int n = strlen(str);
  for (int i = 0; i + 9 < n; i++) {
    bool T = 1;
    for (int j = 0; j < 10; j++) {
      if (j == 2 || j == 5) {
        if (str[i + j] != '-') T = 0;
      } else if (!(str[i + j] >= '0' && str[i + j] <= '9'))
        T = 0;
    }
    if (!T) continue;
    int dat, mon, yea;
    sscanf(str + i, "%2d-%2d-%4d", &dat, &mon, &yea);
    if (dat > 0 && dat <= dd[mon - 1] && mon >= 1 && mon <= 12 && yea >= 2013 &&
        yea <= 2015) {
      ma[yea * 10000 + mon * 100 + dat]++;
      if (ma[yea * 10000 + mon * 100 + dat] > maxi)
        maxi = ma[yea * 10000 + mon * 100 + dat],
        maxik = yea * 10000 + mon * 100 + dat;
    }
  }
  printf("%02d-%02d-%d", maxik % 100, maxik / 100 % 100, maxik / 10000);
  return 0;
}
