#include <bits/stdc++.h>
using namespace std;
char str[100005];
int date[2][13][32];
void processDate(int i) {
  int day = (str[i] - '0') * 10 + (str[i + 1] - '0');
  int month = (str[i + 3] - '0') * 10 + (str[i + 4] - '0');
  int year = (str[i + 6] - '0') * 1000 + (str[i + 7] - '0') * 100 +
             (str[i + 8] - '0') * 10 + (str[i + 9] - '0');
  if (year < 2013 || year > 2015 || month < 1 || month > 12 || day > 31 ||
      day < 1)
    return;
  if ((month == 2 || month == 4 || month == 6 || month == 9 || month == 11) &&
      day > 30)
    return;
  else {
    date[year - 2013][month][day]++;
  }
}
int main() {
  cin >> str;
  for (int i = 0; i < strlen(str) - 10; i++) {
    if (isdigit(str[i]) && isdigit(str[i + 1]) && !isdigit(str[i + 2]) &&
        isdigit(str[i + 3]) && isdigit(str[i + 4]) && !isdigit(str[i + 5]) &&
        isdigit(str[i + 6]) && isdigit(str[i + 7]) && isdigit(str[i + 8]) &&
        isdigit(str[i + 9])) {
      processDate(i);
    }
  }
  int maxdate = 0;
  int maxyear, maxmonth, maxday;
  for (int i = int(0); i <= int(1); i++)
    for (int j = int(1); j <= int(12); j++)
      for (int k = int(1); k <= int(31); k++)
        if (maxdate < date[i][j][k]) {
          maxdate = date[i][j][k];
          maxyear = date[i][j][k];
          maxyear = i + 2013;
          maxmonth = j;
          maxday = k;
        }
  if (maxday < 10)
    printf("0%d-", maxday);
  else
    printf("%d-", maxday);
  if (maxmonth < 10)
    printf("0%d-", maxmonth);
  else
    printf("%d-", maxmonth);
  printf("%d\n", maxyear);
  return 0;
}
