#include <bits/stdc++.h>
using namespace std;
map<string, int> f;
void calc(string s) {
  if (s[2] != '-' || s[5] != '-') return;
  string d = s.substr(0, 2), m = s.substr(3, 2), y = s.substr(6, 4);
  int year = atoi(y.c_str()), month = atoi(m.c_str()), day = atoi(d.c_str());
  if (year < 2013 || year > 2015 || month < 1 || month > 12 || day < 1 ||
      day > 31)
    return;
  f[s]++;
}
int main() {
  string s, MX = "";
  cin >> s;
  for (int i = 0; i < s.size() - 9; i++) calc(s.substr(i, 10));
  int maxi = -1;
  for (map<string, int>::iterator it = f.begin(); it != f.end(); it++)
    if (it->second > maxi) maxi = it->second, MX = it->first;
  cout << MX << endl;
  return 0;
}
