#include <bits/stdc++.h>
using namespace std;
char s[100001];
char kun[3], oy[3], yil[5];
int mmm[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool ucorrectd(char *d, char *m) {
  int mm = (m[0] - '0') * 10 + (m[1] - '0');
  int dd = (d[0] - '0') * 10 + (d[1] - '0');
  if (mm < 13 && mm > 0) {
    if (dd > 0 && dd <= mmm[mm]) return false;
    return true;
  }
  return true;
}
bool ucorrectm(char *m) {
  int mm = (m[0] - '0') * 10 + (m[1] - '0');
  if (mm > 0 && mm <= 12) return false;
  return true;
}
bool ucorrecty(char *y) {
  int yy = (y[0] - '0') * 1000 + (y[1] - '0') * 100 + (y[2] - '0') * 10 +
           (y[3] - '0');
  if (yy >= 2013 && yy <= 2015) return false;
  return true;
}
bool correctdata(char *d, char *m, char *y, char *d1, char *m1, char *y1) {
  int yy = (y[0] - '0') * 1000 + (y[1] - '0') * 100 + (y[2] - '0') * 10 +
           (y[3] - '0');
  int mm = (m[0] - '0') * 10 + (m[1] - '0');
  int dd = (d[0] - '0') * 10 + (d[1] - '0');
  int yy1 = (y1[0] - '0') * 1000 + (y1[1] - '0') * 100 + (y1[2] - '0') * 10 +
            (y1[3] - '0');
  int mm1 = (m1[0] - '0') * 10 + (m1[1] - '0');
  int dd1 = (d1[0] - '0') * 10 + (d1[1] - '0');
  if (yy == yy1 && mm == mm1 && dd == dd1) return true;
  return false;
}
int main() {
  scanf("%s", &s);
  int maxcount = 0;
  int len = strlen(s);
  for (int i = 0; i < len - 10; ++i) {
    int count = 0;
    if (s[i + 2] != '-' || s[i + 5] != '-') continue;
    char dd[3] = {'\0'};
    char mm[3] = {'\0'};
    char yy[5] = {'\0'};
    dd[0] = s[i];
    dd[1] = s[i + 1];
    mm[0] = s[i + 3];
    mm[1] = s[i + 4];
    yy[0] = s[i + 6];
    yy[1] = s[i + 7];
    yy[2] = s[i + 8];
    yy[3] = s[i + 9];
    if (ucorrecty(yy)) continue;
    if (ucorrectm(mm)) continue;
    if (ucorrectd(dd, mm)) continue;
    for (int l = i + 1; l < len - 10; ++l) {
      if (s[l + 2] != '-' || s[l + 5] != '-') continue;
      char dd1[3] = {'\0'};
      char mm1[3] = {'\0'};
      char yy1[5] = {'\0'};
      dd1[0] = s[l];
      dd1[1] = s[l + 1];
      mm1[0] = s[l + 3];
      mm1[1] = s[l + 4];
      yy1[0] = s[l + 6];
      yy1[1] = s[l + 7];
      yy1[2] = s[l + 8];
      yy1[3] = s[l + 9];
      if (ucorrecty(yy1)) continue;
      if (ucorrectm(mm1)) continue;
      if (ucorrectd(dd1, mm1)) continue;
      if (correctdata(dd, mm, yy, dd1, mm1, yy1)) {
        count++;
      }
      if (maxcount < count) {
        kun[0] = dd[0];
        kun[1] = dd[1];
        oy[0] = mm[0];
        oy[1] = mm[1];
        yil[0] = yy[0];
        yil[1] = yy[1];
        yil[2] = yy[2];
        yil[3] = yy[3];
        maxcount = count;
      }
    }
  }
  cout << kun << "-" << oy << "-" << yil;
}
