#include <bits/stdc++.h>
using namespace std;
double const eps = 1e-6;
const int inf = 0x3fffffff;
const int size = 100000 + 5;
map<int, int> cnt;
char str[size];
char sd[10], sm[10], sy[10];
int d, m, y;
bool take(int i) {
  if (i <= 1) return false;
  if (!isdigit(str[i - 2]) || !isdigit(str[i - 1])) return false;
  str[i] = 0;
  sscanf(&str[i - 2], "%d", &d);
  str[i] = '-';
  for (i = i + 1; str[i]; i++)
    if (str[i] == '-') break;
  if (str[i] == 0) return false;
  str[i] = 0;
  sscanf(&str[i - 2], "%d", &m);
  str[i] = '-';
  for (i = i + 1; str[i]; i++)
    if (str[i] == '-') break;
  if (str[i] == 0) return false;
  str[i] = 0;
  sscanf(&str[i - 4], "%d", &y);
  str[i] = '-';
  return true;
}
int ans = 0, ry, rm, rd;
int tmp[7] = {1, 3, 5, 7, 8, 9, 12};
void solve() {
  if (y > 2015 || y < 2013) return;
  if (m < 1 || m > 12) return;
  if (d <= 30) {
    int t = y * 10000 + m * 100 + d;
    if (cnt.find(t) == cnt.end())
      cnt[t] = 1;
    else {
      cnt[t]++;
      if (ans < cnt[t]) {
        ans = cnt[t];
        rm = m, rd = d, ry = y;
      }
    }
  }
  if (d != 31) return;
  for (int i = 0; i < 7; i++)
    if (m == tmp[i]) {
      int t = y * 10000 + m * 100 + d;
      if (cnt.find(t) == cnt.end())
        cnt[t] = 1;
      else {
        cnt[t]++;
        if (ans < cnt[t]) {
          ans = cnt[t];
          rm = m, rd = d, ry = y;
        }
      }
    }
}
int main() {
  scanf("%s", str);
  for (int i = 0; str[i]; i++)
    if (str[i] == '-') {
      take(i);
      solve();
    }
  printf("%2d-%2d-%4d\n", rd, rm, ry);
  return 0;
}
