#include <bits/stdc++.h>
using namespace std;
bool isBetween(int c, int a, int b) {
  if (c >= a && c <= b) return true;
  return false;
}
int main() {
  string s, date;
  vector<string> dates;
  set<string> DA_dates;
  int count, max = 0;
  cin >> s;
  for (unsigned int i = 0; i < s.size() - 9; i++) {
    if (isBetween(s.at(i), 48, 51) && isBetween(s.at(i + 1), 48, 57) &&
        s.at(i + 2) == 45 && isBetween(s.at(i + 3), 48, 49) &&
        isBetween(s.at(i + 4), 48, 57) && s.at(i + 5) == 45 &&
        s.at(i + 6) == 50 && s.at(i + 7) == 48 && s.at(i + 8) == 49 &&
        isBetween(s.at(i + 9), 51, 53)) {
      dates.push_back(s.substr(i, 10));
      DA_dates.insert(DA_dates.begin(), s.substr(i, 10));
    }
  }
  for (auto d = DA_dates.begin(); d != DA_dates.end(); d++) {
    count = 0;
    for (unsigned int i = 0; i < dates.size(); i++) {
      if (dates[i] == *d) count++;
    }
    if (count > max) {
      max = count;
      date = *d;
    }
  }
  cout << date;
  return 0;
}
