#include <bits/stdc++.h>
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
using namespace std;
class date {
 public:
  int dd, mm, yyyy;
};
bool isValid(date a) {
  if (a.yyyy > 2012 && a.yyyy < 2016) {
    if (a.mm >= 1 && a.mm <= 12 && a.dd >= 1) {
      switch (a.mm) {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
          if (a.dd <= 31) return 1;
        case 2:
          if (a.dd <= 28) return 1;
        case 4:
        case 6:
        case 9:
        case 11:
          if (a.dd <= 30) return 1;
      }
    }
  }
  return 0;
}
bool isDgt(char a) {
  if (a >= '0' && a <= '9') return 1;
  return 0;
}
int main() {
  char str[100007];
  cin >> str;
  int i, len = strlen(str);
  map<string, int> dates;
  map<string, int>::iterator it, itf;
  for (i = 0; i <= len - 1; i++) {
    if (str[i] == '-' && str[i + 3] == '-' && i > 1 && i < len - 4) {
      if (isDgt(str[i - 1]) && isDgt(str[i - 2]) && isDgt(str[i + 1]) &&
          isDgt(str[i + 2]) && isDgt(str[i + 4]) && isDgt(str[i + 5]) &&
          isDgt(str[i + 6]) && isDgt(str[i + 7])) {
        date d;
        d.dd = str[i - 2] - 48;
        d.dd = d.dd * 10 + str[i - 1] - 48;
        d.mm = str[i + 1] - 48;
        d.mm = d.mm * 10 + str[i + 2] - 48;
        d.yyyy = str[i + 4] - 48;
        d.yyyy = d.yyyy * 10 + str[i + 5] - 48;
        d.yyyy = d.yyyy * 10 + str[i + 6] - 48;
        d.yyyy = d.yyyy * 10 + str[i + 7] - 48;
        if (isValid(d)) {
          char s[20];
          if (d.dd < 10 && d.mm < 10)
            sprintf(s, "0%d-0%d-%d", d.dd, d.mm, d.yyyy);
          else if (d.dd < 10 && d.mm >= 10)
            sprintf(s, "0%d-%d-%d", d.dd, d.mm, d.yyyy);
          else if (d.dd >= 10 && d.mm < 10)
            sprintf(s, "%d-0%d-%d", d.dd, d.mm, d.yyyy);
          else
            sprintf(s, "%d-%d-%d", d.dd, d.mm, d.yyyy);
          s[10] = '\0';
          it = dates.find(s);
          if (it == dates.end()) {
            dates.insert(pair<string, int>(s, 0));
          } else {
            it->second = it->second + 1;
          }
        }
      }
    }
  }
  itf = dates.begin();
  int mx = itf->second;
  for (it = dates.begin(); it != dates.end(); it++) {
    if (it->second > itf->second) {
      itf = it;
    }
  }
  cout << itf->first;
  return 0;
}
