#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int i, j;
  string help;
  bool day = false, mon = false;
  map<string, int> opadaa;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '2' && s[i + 1] == '0' && s[i + 2] == '1' &&
        (s[i + 3] == '3' || s[i + 3] == '4' || s[i + 3] == '5')) {
      day = true;
      for (j = i - 6; j <= i + 3; j++) {
        help += s[j];
      }
      if (help[0] >= 3) {
        if (help[0] - '0' == 3 && help[1] - '0' > 1) help[0] = '0';
        if (help[0] - '0' > 3) help[0] = '0';
      }
      if (help[3] - '0' >= 1) {
        if (help[3] - '0' > 1) help[3] = '0';
        if (help[3] - '0' == 1 && help[4] - '0' > 2) help[3] = '0';
      }
      opadaa[help]++;
      help.clear();
    }
  }
  int maxx = -1;
  string f;
  for (map<string, int>::iterator it = opadaa.begin(); it != opadaa.end();
       it++) {
    if (it->second > maxx) {
      maxx = it->second;
      f = it->first;
    }
  }
  cout << f;
  return 0;
}
