#include <bits/stdc++.h>
using namespace std;
inline bool digit(char c) { return '0' <= c && c <= '9'; }
map<int, int> dates;
void mem(char *s) {
  char b[11];
  memcpy(b, s, 10);
  static int di[8] = {0, 1, 3, 4, 6, 7, 8, 9};
  static int dpm[12] = {31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int d, m, y;
  for (int i(0); i < 8; ++i) {
    if (!digit(s[di[i]])) return;
  }
  if (s[2] != '-' || s[5] != '-') return;
  d = atoi(b);
  m = atoi(b + 3);
  y = atoi(b + 6);
  if (m <= 0 || m > 12) return;
  if (d <= 0 || d > dpm[m - 1]) return;
  if (!(2013 <= y && y <= 2015)) return;
  int key = (d << 24) | (m << 16) | y;
  map<int, int>::iterator it = dates.find(key);
  if (it != dates.end()) {
    it->second++;
  } else {
    dates.insert(make_pair(key, 1));
  }
}
char s[100001];
int main() {
  scanf("%s", s);
  int l(strlen(s));
  for (int i(0); i < l - 10; ++i) {
    mem(&s[i]);
  }
  int result(0), count(0);
  for (map<int, int>::iterator i = dates.begin(); i != dates.end(); ++i) {
    if (i->second > count) {
      count = i->second;
      result = i->first;
    }
  }
  printf("%02d-%02d-%d", result >> 24, (result >> 16) & 0xff, result & 0xffff);
  return 0;
}
