#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long n = s.size();
  unordered_map<string, long long> m;
  for (long long i = 0; i < n - 3; i++) {
    if (s[i] == '2' && s[i + 1] == '0' && s[i + 2] == '1' &&
        (s[i + 3] == '3' || s[i + 3] == '4' || s[i + 3] == '5')) {
      long long j = i - 6;
      if (j >= 0) {
        string temp = "";
        for (long long k = j; k <= i + 3; k++) temp += s[k];
        m[temp]++;
      }
    }
  }
  priority_queue<pair<long long, string> > pq;
  for (auto i : m) {
    pq.push(make_pair(i.second, i.first));
  }
  while (!pq.empty()) {
    pair<long long, string> p = pq.top();
    pq.pop();
    string date = p.second;
    long long n1 = date.size();
    long long c = 0;
    for (long long i = 0; i < n1; i++) {
      if (date[i] == '-') c++;
    }
    if (c > 2) continue;
    string temp = "";
    temp += date[0];
    temp += date[1];
    long long day = stoi(temp);
    temp = "";
    temp += date[3];
    temp += date[4];
    long long month = stoi(temp);
    if (month == 2 && (day >= 1 && day <= 28)) {
      cout << date;
      return 0;
    }
    if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 ||
        month == 10 || month == 12) {
      if (day >= 1 && day <= 31) {
        cout << date;
        return 0;
      }
    } else if (month == 4 || month == 6 || month == 9 || month == 11) {
      if (day >= 1 && day <= 30) {
        cout << date;
        return 0;
      }
    }
  }
  return 0;
}
