#include <bits/stdc++.h>
using namespace std;
string s, anss;
int i, cnt[33][14][6];
int kt[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  cin >> s;
  int ans = 0;
  for (i = 0; i < s.size() - 10; i++)
    if (s[i + 2] == '-' && s[i + 5] == '-' && s[i + 6] == '2' &&
        s[i + 7] == '0' && s[i + 8] == '1') {
      int d = (s[i] - 48) * 10 + (s[i + 1] - 48),
          m = (s[i + 3] - 48) * 10 + (s[i + 4] - 48), y = s[i + 9] - 48;
      if (m > 12 || kt[m - 1] < d || y < 3 || y > 5) continue;
      ++cnt[d][m][y];
      if (ans < cnt[d][m][y]) {
        ans = cnt[d][m][y];
        anss = s.substr(i, 10);
      }
    }
  cout << anss;
  return 0;
}
