#include <bits/stdc++.h>
using namespace std;
int day(string s) {
  int l = s.length();
  if (l <= 1) return -1;
  return (s[l - 2] - '0') * 10 + (s[l - 1] - '0');
}
int month(string s) {
  int l = s.length();
  if (l != 2) return -1;
  return (s[l - 2] - '0') * 10 + (s[l - 1] - '0');
}
int year(string s) {
  int l = s.length();
  if (l <= 3) return -1;
  return (s[l - 4] - '0') * 1000 + (s[l - 3] - '0') * 100 +
         (s[l - 2] - '0') * 10 + (s[l - 1] - '0');
}
bool checkValid(int dd, int mm, int yyyy) {
  if (mm >= 1 && mm <= 12 && yyyy >= 2013 && yyyy <= 2015) {
    int month_days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if (dd >= 1 && dd <= month_days[mm]) return true;
  }
  return false;
}
int main() {
  string s, cur, prev = "", prevprev = "";
  map<long, int> cnt;
  int max = 0, maxdd, maxmm, maxyyyy;
  cin >> s;
  stringstream ss(s);
  while (getline(ss, cur, '-')) {
    int dd = day(prevprev);
    int mm = month(prev);
    int yyyy = year(cur);
    if (checkValid(dd, mm, yyyy)) {
      int k = yyyy * 10000 + mm * 100 + dd;
      if (cnt.find(k) == cnt.end())
        cnt[k] = 1;
      else
        cnt[k] += 1;
      if (max < cnt[k]) {
        max = cnt[k];
        maxdd = dd;
        maxmm = mm;
        maxyyyy = yyyy;
      }
    }
    prevprev = prev;
    prev = cur;
  }
  printf("%02d-%02d-%d\n", maxdd, maxmm, maxyyyy);
}
