#include <bits/stdc++.h>
using namespace std;
bool isint(char c) { return (int(c) >= int('0')) && (int(c) <= int('9')); }
bool isyear(string str) {
  return (str == "2015" || str == "2014" || str == "2013");
}
bool check(string str) {
  int d = int(str[1] - '0') + int(str[0] - '0') * 10;
  int m = int(str[4] - '0') + int(str[3] - '0') * 10;
  if (m == 2 && d < 29 && d > 0) return 1;
  if ((m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) &&
      d <= 31 && d > 0)
    return 1;
  if ((m == 4 || m == 6 || m == 9 || m == 11) && d <= 30 && d > 0) return 1;
  return 0;
}
int main() {
  string str;
  cin >> str;
  map<string, int> m;
  for (int i = 2; i <= str.size() - 8; i++) {
    if (str[i] == '-' && str[i + 3] == '-' && isint(str[i - 2]) &&
        isint(str[i - 1]) && isint(str[i + 1]) && isint(str[i + 2])) {
      if (isyear(str.substr(i + 4, 4))) {
        string s = str.substr(i - 2, 10);
        if (check(s)) {
          if (m.find(s) == m.end())
            m.insert(make_pair(s, 0));
          else
            m[s]++;
        }
      }
    }
  }
  map<string, int>::iterator it = m.begin();
  int mx = 0;
  string ans = "";
  for (; it != m.end(); it++)
    if (it->second > mx) ans = it->first, mx = it->second;
  cout << ans << endl;
}
