#include <bits/stdc++.h>
using namespace std;
char input[100000] = {0};
int table[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  scanf("%s", &input);
  char s[11];
  s[10] = 0;
  map<string, int> p;
  int len = strlen(input);
  for (int i = 0; i < len - 10; i++) {
    if (input[i + 2] != '-' || input[i + 5] != '-' || input[i + 6] != '2' ||
        input[i + 7] != '0' || input[i + 8] != '1')
      continue;
    int temp = input[i + 9] - '0';
    if (temp > 5 || temp < 3) continue;
    int dd = (input[i] - '0') * 10 + (input[i + 1] - '0');
    int mm = (input[i + 3] - '0') * 10 + (input[i + 4] - '0');
    if (mm > 12 || mm < 0) continue;
    if (dd > table[mm - 1] || dd < 0) continue;
    strncpy(s, input + i, 10);
    map<string, int>::iterator it;
    string ts = string(s);
    it = p.find(ts);
    if (it == p.end()) {
      p.insert(make_pair(ts, 1));
    } else {
      it->second++;
    }
  }
  int max = 0;
  string res;
  map<string, int>::iterator it;
  for (it = p.begin(); it != p.end(); it++) {
    if (it->second > max) {
      max = it->second;
      res = it->first;
    }
  }
  printf("%s", res.c_str());
  return 0;
}
