#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> subs;
  int l;
  string a, b;
  cin >> a;
  l = a.size();
  for (int i = 0; i < l - 9; ++i) {
    b = a.substr(i, 10);
    if ((b[2] == '-' && b[5] == '-') &&
        ((((b[0] - '0') * 10 + b[1] - '0') <= 28) &&
         (((b[0] - '0') * 10 + b[1] - '0') > 0)) &&
        ((((b[3] - '0') * 10 + b[4] - '0') <= 12) &&
         (((b[3] - '0') * 10 + b[4] - '0') > 0)) &&
        ((b[6] == '2') && (b[7] == '0') && (b[8] == '1') &&
         ((b[9] - '0') >= 3) && ((b[9] - '0') <= 5)) &&
        (((b[0] >= '0') && (b[0] <= '9')) && ((b[1] >= '0') && (b[1] <= '9')) &&
         ((b[3] >= '0') && (b[3] <= '9')) &&
         ((b[4] >= '0') && (b[4] <= '9')))) {
      subs.push_back(b);
    } else if ((((b[3] - '0') * 10 + b[4] - '0') != 2) &&
               (b[2] == '-' && b[5] == '-') &&
               ((((b[0] - '0') * 10 + b[1] - '0') > 28) &&
                (((b[0] - '0') * 10 + b[1] - '0') <= 30)) &&
               ((((b[3] - '0') * 10 + b[4] - '0') <= 12) &&
                (((b[3] - '0') * 10 + b[4] - '0') > 0)) &&
               ((b[6] == '2') && (b[7] == '0') && (b[8] == '1') &&
                ((b[9] - '0') >= 3) && ((b[9] - '0') <= 5)) &&
               (((b[0] >= '0') && (b[0] <= '9')) &&
                ((b[1] >= '0') && (b[1] <= '9')) &&
                ((b[3] >= '0') && (b[3] <= '9')) &&
                ((b[4] >= '0') && (b[4] <= '9')))) {
      subs.push_back(b);
    } else if ((((b[3] - '0') * 10 + b[4] - '0') != 11) &&
               (((b[3] - '0') * 10 + b[4] - '0') != 9) &&
               (((b[3] - '0') * 10 + b[4] - '0') != 6) &&
               (((b[3] - '0') * 10 + b[4] - '0') != 4) &&
               (((b[3] - '0') * 10 + b[4] - '0') != 2) &&
               (b[2] == '-' && b[5] == '-') &&
               ((((b[0] - '0') * 10 + b[1] - '0') == 31)) &&
               ((((b[3] - '0') * 10 + b[4] - '0') <= 12) &&
                (((b[3] - '0') * 10 + b[4] - '0') > 0)) &&
               ((b[6] == '2') && (b[7] == '0') && (b[8] == '1') &&
                ((b[9] - '0') >= 3) && ((b[9] - '0') <= 5)) &&
               (((b[0] >= '0') && (b[0] <= '9')) &&
                ((b[1] >= '0') && (b[1] <= '9')) &&
                ((b[3] >= '0') && (b[3] <= '9')) &&
                ((b[4] >= '0') && (b[4] <= '9')))) {
      subs.push_back(b);
    }
  }
  l = subs.size();
  sort(subs.begin(), subs.end());
  subs.push_back("");
  int cmax = -1;
  int ccur = 0;
  b = "";
  for (int i = 0; i < l; ++i) {
    if (subs[i] == subs[i + 1]) {
      ccur++;
    } else {
      if (ccur > cmax) {
        cmax = ccur;
        b = subs[i];
      }
      ccur = 0;
    }
  }
  cout << b << endl;
  return 0;
}
