#include <bits/stdc++.h>
char a[100050];
int kel[50][50][10];
int mm[15] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  scanf("%s", a);
  int s = strlen(a);
  for (int i = 0; i <= s - 10; i++) {
    int q = 0;
    for (int j = i; j < i + 10; j++) {
      if (j - i == 2 || j - i == 5) {
        if (a[j] != '-') q = 1;
      } else if (a[j] < 48 || a[j] > 58)
        q = 1;
    }
    if (q == 0) {
      int d = 0, m = 0, y = 0;
      d = (a[i] - 48) * 10 + (a[i + 1] - 48);
      m = (a[i + 3] - 48) * 10 + (a[i + 4] - 48);
      y = (a[i + 6] - 48) * 10 + (a[i + 7] - 48);
      y = y * 10 + (a[i + 8] - 48);
      y = y * 10 + (a[i + 9] - 48);
      if (y >= 2013 && y <= 2015 && m >= 1 && m <= 12 && d > 0 &&
          d <= mm[m - 1])
        kel[d][m][y - 2013]++;
    }
  }
  int maxx = 0;
  for (int i = 0; i < 32; i++)
    for (int ii = 0; ii < 15; ii++)
      for (int iii = 0; iii < 5; iii++)
        if (maxx < kel[i][ii][iii]) maxx = kel[i][ii][iii];
  for (int i = 0; i < 32; i++)
    for (int ii = 0; ii < 15; ii++)
      for (int iii = 0; iii < 5; iii++)
        if (maxx == kel[i][ii][iii]) printf("%d-%d-%d", i, ii, iii + 2013);
  getchar();
  getchar();
}
