#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, m, d, y, cnt = 1, ind = 0, mx = INT_MIN;
  vector<string> v;
  map<int, int> mp;
  mp[1] = 31;
  mp[2] = 28;
  mp[3] = 31;
  mp[4] = 30;
  mp[5] = 31;
  mp[6] = 30;
  mp[7] = 31;
  mp[8] = 31;
  mp[9] = 30;
  mp[10] = 31;
  mp[11] = 30;
  mp[12] = 31;
  string s, date;
  cin >> s;
  int n = s.length();
  for (i = 0; i <= n - 10; i++) {
    date.clear();
    m = 0, d = 0, y = 0;
    if (s[i + 2] == '-' && s[i + 5] == '-') {
      m = (s[i + 3] - '0') * 10 + (s[i + 4] - '0');
      if (m <= 12)
        ;
      {
        d = (s[i] - '0') * 10 + (s[i + 1] - '0');
        if (d <= mp[m]) {
          y = (s[i + 6] - '0') * 1000 + (s[i + 7] - '0') * 100 +
              (s[i + 8] - '0') * 10 + (s[i + 9] - '0');
          if (y >= 2013 && y <= 2015) {
            for (j = i; j < i + 10; j++) {
              date.push_back(s[j]);
            }
            v.push_back(date);
          }
        }
      }
    }
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++) {
    if (v[i] == v[i + 1]) {
      cnt++;
      if (cnt > mx) {
        mx = cnt;
        ind = i;
      }
      if (i + 1 == n - 1) break;
    } else {
      cnt = 1;
    }
  }
  cout << v[ind] << endl;
}
