#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
char a[maxn];
int b[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char c[11];
char ans[11];
int main() {
  scanf("%s", a);
  int len = strlen(a);
  for (int i = 0; i < len - 10; i++) {
    int dd, mm, year;
    memcpy(c, a + i, 10);
    if (c[2] == '-' && c[5] == '-') {
      year = int(c[6] - '0') * 1000 + int(c[7] - '0') * 100 +
             int(c[8] - '0') * 10 + int(c[9] - '0');
      if (year < 2013 || year > 2015) {
        continue;
      }
      mm = int(c[3] - '0') * 10 + int(c[4] - '0');
      if (mm < 1 || mm > 12) continue;
      dd = int(c[0] - '0') * 10 + int(c[1] - '0');
      if (dd <= 0 || dd > b[mm - 1]) continue;
      memcpy(ans, a + i + 8, 10);
      if (!strcmp(ans, c)) {
        cout << ans << endl;
      }
    }
  }
}
