#include <bits/stdc++.h>
using namespace std;
int month(string d) {
  if (d == "01" || d == "03" || d == "05" || d == "07" || d == "08" ||
      d == "10" || d == "12") {
    return 31;
  } else if (d == "04" || d == "06" || d == "09" || d == "11") {
    return 30;
  } else
    return 28;
}
int main() {
  string s;
  cin >> s;
  int x = s.length();
  map<string, int> mp;
  for (int i = 0; i < x - 9; i++) {
    if (s[i + 2] == '-' && s[i + 5] == '-') {
      int date = (s[i] - 48) * 10 + (s[i + 1] - 48);
      int mo = (s[i + 3] - 48) * 10 + (s[i + 4] - 48);
      int monthday = month({s[i + 3], s[i + 4]});
      int year = (s[i + 6] - 48) * 1000 + (s[i + 7] - 48) * 100 +
                 (s[i + 8] - 48) * 10 + (s[i + 9] - 48);
      ;
      if (mo < 13 && date < monthday && year >= 2013 && year <= 2015) {
        string t = {s[i],     s[i + 1], s[i + 2], s[i + 3], s[i + 4],
                    s[i + 5], s[i + 6], s[i + 7], s[i + 8], s[i + 9]};
        mp[t] += 1;
      }
    }
  }
  int ma = -1;
  map<string, int>::iterator itr;
  for (itr = mp.begin(); itr != mp.end(); itr++) {
    if (itr->second > ma) {
      s = itr->first;
      ma = itr->second;
    }
  }
  cout << s;
  return 0;
}
