#include <bits/stdc++.h>
using namespace std;
bool match(string &str, int i, int len = 10) {
  int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  if (str[i + 2] == '-' && str[i + 5] == '-') {
    int day = atoi(str.substr(i, 2).c_str());
    int month = atoi(str.substr(i + 3, 2).c_str());
    int year = atoi(str.substr(i + 6, 4).c_str());
    string d, m, y;
    stringstream convert;
    convert << day << " " << month << " " << year;
    convert >> d >> m >> y;
    if (d == str.substr(i, 2) && m == str.substr(i + 3, 2) &&
        y == str.substr(i + 6, 4)) {
      if (year >= 2012 && year <= 2015) {
        if (month >= 0 && month <= 12)
          if (day >= 0 && day <= days[month]) return true;
      }
    }
  }
  return false;
}
int main() {
  string s;
  cin >> s;
  map<string, int> occ;
  for (int i = 0; i < s.size() - 9; i++) {
    if (match(s, i)) {
      occ[s.substr(i, 10)]++;
    }
  }
  int maxCount = 0;
  string maxEl = "";
  for (const pair<string, int> &el : occ) {
    if (maxCount < el.second) {
      maxCount = el.second;
      maxEl = el.first;
    }
  }
  cout << maxEl << endl;
  return 0;
}
