#include <bits/stdc++.h>
using namespace std;
int cnt[35][15][5];
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool Validate(string input) {
  vector<int> idx;
  int i, day, month, year;
  if (input.length() != 10) return false;
  for (i = 0; i < input.length(); i++)
    if (input[i] == '-') idx.push_back(i);
  for (i = 0; i < idx.size(); i++)
    if (idx[i] != 2 && idx[i] != 5) return false;
  day = atoi(input.substr(0, 2).c_str());
  month = atoi(input.substr(3, 2).c_str());
  year = atoi(input.substr(6, 4).c_str());
  if (year < 2013 || year > 2015) return false;
  if (month < 1 || month > 12) return false;
  if (day < 1 || day > days[month - 1]) return false;
  cnt[day - 1][month - 1][year - 2013]++;
}
int main() {
  int i, j, k, cur = 0, x = 0, y = 0, z = 0;
  string input;
  cin >> input;
  for (i = 0; i + 9 < input.length(); i++) Validate(input.substr(i, 10));
  for (i = 0; i < 32; i++)
    for (j = 0; j < 13; j++)
      for (k = 0; k < 4; k++)
        if (cnt[i][j][k] > cur) {
          cur = cnt[i][j][k];
          x = i;
          y = j;
          z = k;
        }
  printf("%02d-%02d-%d\n", x + 1, y + 1, z + 2013);
  return 0;
}
