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