#include <bits/stdc++.h>
using namespace std;
map<pair<pair<int, int>, int>, int> u;
int days(int m) {
  if (m == 2) return 28;
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    return 31;
  }
  return 30;
}
pair<pair<int, int>, int> valid(string u) {
  int i, d, m, y;
  for (i = 0; i < 10; ++i) {
    if (u[i] == '-') {
      if (i == 2 || i == 5) continue;
      return make_pair(make_pair(-1, 0), 0);
    }
    u[i] -= '0';
  }
  d = u[0] * 10 + u[1];
  m = u[3] * 10 + u[4];
  y = u[6] * 1000 + u[7] * 100 + u[8] * 10 + u[9];
  if (y < 2013 || y > 2015) return make_pair(make_pair(-1, 0), 0);
  if (m < 1 || m > 12) return make_pair(make_pair(-1, 0), 0);
  if (d < 1) return make_pair(make_pair(-1, 0), 0);
  if (days(m) < d) return make_pair(make_pair(-1, 0), 0);
  return make_pair(make_pair(d, m), y);
}
char str[100010];
int main(void) {
  int i, a, n, b, j;
  string r;
  scanf("%s", str);
  int len = strlen(str) - 1;
  for (i = 0; i <= len - 10 + 1; ++i) {
    r = "";
    for (j = 0; j < 10; ++j) {
      r += str[i + j];
    }
    pair<pair<int, int>, int> x = valid(r);
    if (x.first.first == -1) continue;
    if (u.find(x) == u.end())
      u[x] = 1;
    else {
      u[x]++;
    }
  }
  int ans = -1;
  pair<pair<int, int>, int> adate;
  for (map<pair<pair<int, int>, int>, int>::iterator j = u.begin();
       j != u.end(); ++j) {
    if (j->second > ans) {
      ans = j->second;
      adate = j->first;
    }
  }
  printf("%.2d-%.2d-%d\n", adate.first.first, adate.first.second, adate.second);
  return 0;
}
