#include <bits/stdc++.h>
using namespace std;
string s, ans[1000000];
const string f = "dd-mm-yyyy";
const int day[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int k;
map<string, int> mp;
int main() {
  cin >> s;
  for (int i = 0; i < s.size() - f.size() + 1; i++) {
    string c = s.substr(i, f.size());
    if (c[2] == '-' && c[5] == '-') {
      int d, m, y;
      d = (c[0] - '0') * 10 + (c[1] - '0');
      m = (c[3] - '0') * 10 + (c[4] - '0');
      y = (c[6] - '0') * 1000 + (c[7] - '0') * 100 + (c[8] - '0') * 10 +
          (c[9] - '0');
      if (m >= 1 && m <= 12 && d >= 1 && d <= day[m] && y >= 2013 &&
          y <= 2015) {
        ans[k] = c;
        k++;
        mp[c]++;
      }
    }
  }
  string ans1;
  int maxn = 0;
  for (int i = 0; i < k; i++) {
    if (mp[ans[i]] > maxn) {
      maxn = mp[ans[i]];
      ans1 = ans[i];
    }
  }
  cout << ans1;
  return 0;
}
