#include <bits/stdc++.h>
using namespace std;
char s[100100];
int len;
int checkmou[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
struct Date {
  int day, mouth, year;
} ans;
int cnt[5][15][35];
char p[100100];
int maxcnt = 0;
void check(int L, int R) {
  int day = 0, mou = 0, year = 0;
  for (int i = L; i < L + 2; i++) {
    if (p[i] == '-') return;
    day = day * 10 + p[i] - '0';
  }
  if (p[L + 2] != '-') return;
  for (int i = L + 3; i < L + 5; i++) {
    if (p[i] == '-') return;
    mou = mou * 10 + p[i] - '0';
  }
  if (p[L + 5] != '-') return;
  for (int i = L + 6; i < L + 10; i++) {
    if (p[i] == '-') return;
    year = year * 10 + p[i] - '0';
  }
  if (year < 2013 || year > 2015) return;
  if (mou < 1 || mou > 12) return;
  if (day < 1 || day > checkmou[mou]) return;
  cnt[year - 2013][mou][day]++;
  if (cnt[year - 2013][mou][day] > maxcnt) {
    maxcnt = cnt[year - 2013][mou][day];
    ans.year = year;
    ans.mouth = mou;
    ans.day = day;
  }
}
int main(void) {
  cin >> s + 1;
  len = strlen(s + 1);
  int L = 1;
  for (int i = 1; i <= len; i++) p[i] = s[i];
  check(1, 10);
  for (int i = 11; i <= len; i++) {
    ++L;
    if (L + 9 > len) break;
    check(L, i);
  }
  printf("%02d-%02d-%04d", ans.day, ans.mouth, ans.year);
  cout << endl << maxcnt;
  return 0;
}
