#include <bits/stdc++.h>
using namespace std;
bool check(string s) {
  long long d = (s[0] - 48) * 10 + (s[1] - 48);
  if (s[2] != '-') return false;
  long long m = (s[3] - 48) * 10 + (s[4] - 48);
  if (s[5] != '-') return false;
  if (m < 1 || m > 12) {
    return false;
  }
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    if (d < 1 || d > 31) {
      return false;
    }
  }
  if (s[6] != '2' || s[7] != '0' || s[8] != '1') {
    return false;
  }
  if (s[9] == '3' || s[9] == '4' || s[9] == '5') {
    return true;
  }
  return false;
}
int32_t main() {
  string s = "aa";
  string str;
  cin >> str;
  s += str;
  s += "aaaaaaa";
  map<string, long long> make_pair;
  long long l = str.length();
  for (long long i = 2; i < l; i++) {
    string p;
    if (s[i] == '-') {
      p = s.substr(i - 2, 10);
      if (check(p)) {
        make_pair[p]++;
      }
    }
  }
  long long a = INT_MIN;
  string q;
  map<string, long long> z = make_pair;
  for (auto i : z) {
    if (i.second > a) {
      a = i.second;
      q = i.first;
    }
  }
  cout << q << "\n";
  return 0;
}
