#include <bits/stdc++.h>
using namespace std;
void Speed() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  Speed();
  string s;
  cin >> s;
  map<string, int> mymap;
  for (int i = 6; i < s.length() - 3; i++) {
    if (s[i] == '2' && s[i + 1] == '0' && s[i + 2] == '1') {
      if (s[i + 3] == '3' || s[i + 3] == '4' || s[i + 3] == '5') {
        string x = s.substr(i - 6, 10);
        mymap[x]++;
      }
    }
  }
  map<string, int>::iterator it = mymap.begin();
  int temp = 0;
  string res = "";
  for (; it != mymap.end(); it++) {
    if (it->second > temp) {
      res = it->first;
      temp = it->second;
    }
  }
  cout << res << endl;
  return 0;
}
