#include <bits/stdc++.h>
using namespace std;
int mon[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char str[100010];
int po[100010], num = 0;
int vis[3][13][32];
int main() {
  scanf("%s", str + 1);
  int i, len = strlen(str + 1);
  memset(vis, 0, sizeof(vis));
  po[0] = 0;
  for (i = 1; i <= len; i++) {
    if (str[i] == '-') po[++num] = i;
  }
  po[num + 1] = len + 1;
  int mm, dd;
  int yy = 0, m = 0, d = 0, max = 0;
  for (i = 1; i < num; i++) {
    int x = po[i], y = po[i + 1];
    if (po[i] - po[i - 1] >= 3 && po[i + 1] - po[i] == 3 &&
        po[i + 2] - po[i + 1] >= 5 && str[y + 1] == '2' && str[y + 2] == '0' &&
        str[y + 3] == '1' && str[y + 4] <= '5' && str[y + 4] >= '3') {
      dd = (str[x - 2] - '0') * 10 + str[x - 1] - '0';
      mm = (str[x + 1] - '0') * 10 + str[x + 2] - '0';
      if (mm > 0 && mm < 13) {
        if (dd > 0 && dd <= mon[mm]) {
          vis[str[y + 4] - '3'][mm][dd]++;
          if (vis[str[y + 4] - '3'][mm][dd] > max) {
            max = vis[str[y + 4] - '3'][mm][dd];
            yy = 2010 + str[y + 4] - '0';
            m = mm, d = dd;
          }
        }
      }
    }
  }
  printf("%d-%d-%d\n", d, m, yy);
  return 0;
}
