#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, m, y, total = -1, index, i, j;
  string s, sub;
  vector<pair<string, long long> > st;
  cin >> s;
  for (i = 0; i < s.length() - 9; i++) {
    if (s[i + 2] == '-' && s[i + 5] == '-' && s[i + 6] != '-' &&
        s[i + 7] != '-' && s[i + 8] != '-' && s[i + 9] != '-') {
      sub = s.substr(i, 10);
      stringstream date(sub.substr(0, 1)), month(sub.substr(3, 4)),
          year(sub.substr(6, 9));
      date >> d;
      month >> m;
      year >> y;
      if ((y > 2012 && y < 2016) &&
          ((m == 1 && d > 0 && d < 32) || (m == 2 && d > 0 && d < 29) ||
           (m == 3 && d > 0 && d < 32) || (m == 4 && d > 0 && d < 31) ||
           (m == 5 && d > 0 && d < 32) || (m == 6 && d > 0 && d < 31) ||
           (m == 7 && d > 0 && d < 32) || (m == 8 && d > 0 && d < 32) ||
           (m == 9 && d > 0 && d < 31) || (m == 10 && d > 0 && d < 32) ||
           (m == 11 && d > 0 && d < 31) || (m == 12 && d > 0 && d < 32))) {
        for (j = 0; j < st.size(); j++) {
          if (st[j].first == sub) {
            st[j].second++;
            break;
          }
        }
        if (j == st.size()) {
          st.push_back(make_pair(sub, 1));
        }
      }
    }
  }
  for (i = 0; i < st.size(); i++) {
    if (st[i].second > total) {
      total = st[i].second;
      index = i;
    }
  }
  cout << st[index].first;
  return 0;
}
