#include <bits/stdc++.h>
using namespace std;
int day[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
map<string, int> mp;
string s;
int main() {
  int mx = 0, y, m, d, j;
  string mxi, x;
  cin >> s;
  for (int i = 0; i + 10 <= (int)s.length(); i++) {
    x = s.substr(i, 10);
    if (sscanf((x).c_str(), "%2d-%2d-%4d", &d, &m, &y, &j) != 3) {
      continue;
    }
    if (y < 2013 || y > 2015) {
      continue;
    }
    if (m < 1 || m > 12) {
      continue;
    }
    if (d < 1 || d > day[m]) {
      continue;
    }
    mp[x]++;
    if (mx < mp[x]) {
      mx = mp[x];
      mxi = x;
    }
  }
  cout << mxi;
  return 0;
}
