#include <bits/stdc++.h>
using namespace std;
int main() {
  freopen("output.out", "w", stdout);
  freopen("input.in", "r", stdin);
  int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  char s[100020];
  cin >> s;
  int n = strlen(s);
  int cnt[35][35][35] = {0}, dd, mm, yy, max = 0, ansday, ansmon, ansyear, day1,
      month1;
  for (int i = 0; i + 9 < n; i++) {
    dd = 0;
    mm = 0;
    yy = 0;
    if (s[i + 2] != '-' && s[i + 5] != '-') continue;
    int boolean = 1;
    for (int j = 0; j < 10; j++)
      if (j != 2 && j != 5 && j == '-') boolean = 0;
    if (!boolean) continue;
    dd += (s[i] - '0');
    dd *= 10;
    dd += (s[i + 1] - '0');
    mm += (s[i + 3] - '0');
    mm *= 10;
    mm += (s[i + 4] - '0');
    yy = s[i + 9] - '0';
    if (2010 + yy < 2013 || 2010 + yy > 2015) continue;
    if (mm < 1 || mm > 12) continue;
    if (dd < 0 || dd > months[mm]) continue;
    cnt[yy][mm][dd]++;
    if (cnt[yy][mm][dd] > max) {
      max = cnt[yy][mm][dd];
      ansday = dd;
      ansmon = mm;
      ansyear = yy;
    }
  }
  cout << ansday << "-" << ansmon << "-" << 2010 + ansyear << endl;
  return 0;
}
