#include <bits/stdc++.h>
using namespace std;
const char InName[] = "input.txt";
const char OutName[] = "output.txt";
string S;
int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int ap[3][13][32];
inline bool GoodFormat(int pos) {
  if (pos + 9 >= S.size()) return false;
  if (isdigit(S[pos + 0]) && isdigit(S[pos + 1]) && S[pos + 2] == '-' &&
      isdigit(S[pos + 3]) && isdigit(S[pos + 4]) && S[pos + 5] == '-' &&
      isdigit(S[pos + 6]) && isdigit(S[pos + 7]) && isdigit(S[pos + 8]) &&
      isdigit(S[pos + 9]))
    return true;
  return false;
}
int make(int nr) {
  if (nr < 10) cout << 0;
  return nr;
}
int main() {
  cin >> S;
  for (int i = 0; i < S.size(); i++) {
    if (GoodFormat(i)) {
      int day = (S[i] - '0') * 10 + S[i + 1] - '0';
      int month = (S[i + 3] - '0') * 10 + S[i + 4] - '0';
      int year = (S[i + 6] - '0') * 1000 + (S[i + 7] - '0') * 100 +
                 (S[i + 8] - '0') * 10 + S[i + 9] - '0';
      if (year < 2013 || year > 2015) continue;
      if (month < 1 || month > 12) continue;
      if (day < 1 || day > days[month]) continue;
      ap[year - 2013][month][day]++;
    }
  }
  int sol = 0, i1, i2, i3;
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 13; ++j)
      for (int k = 0; k < 32; ++k)
        if (ap[i][j][k] > sol) {
          sol = ap[i][j][k];
          i1 = i;
          i2 = j;
          i3 = k;
        }
  cout << make(i3) << '-' << make(i2) << '-' << i1 + 2013 << '\n';
  return 0;
}
