#include <bits/stdc++.h>
using namespace std;
char tst[] = "xx-xx-xxxx";
int tam = strlen(tst);
bool valid(char *s) {
  for (int i = 0; i < tam; i++) {
    if (tst[i] == 'x' && s[i] >= '0' && s[i] <= '9') continue;
    if (tst[i] == '-' && s[i] == '-') continue;
    return false;
  }
  return true;
}
int main() {
  char line[10010];
  int dia, mes, ano;
  map<pair<int, pair<int, int> >, int> mymap;
  map<pair<int, pair<int, int> >, int>::iterator it;
  scanf("%s", line);
  while (line[0]) {
    if (valid(line)) {
      sscanf(line, "%2d-%2d-%4d", &dia, &mes, &ano);
      if (dia > 0 && mes >= 1 && mes <= 12 && ano >= 2013 && ano <= 2015) {
        pair<int, pair<int, int> > aux = make_pair(dia, make_pair(mes, ano));
        it = mymap.find(aux);
        if (it == mymap.end()) {
          mymap[aux] = 1;
        } else {
          it->second += 1;
        }
      }
    }
    for (int j = 0; line[j]; j++) line[j] = line[j + 1];
  }
  int maior = 0;
  pair<int, pair<int, int> > aux;
  for (it = mymap.begin(); it != mymap.end(); it++) {
    if ((*it).second > maior) {
      maior = (*it).second;
      aux = (*it).first;
    }
  }
  printf("%2d-%2d-%4d", aux.first, aux.second.first, aux.second.second);
  return 0;
}
