#include <bits/stdc++.h>
using namespace std;
int w[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string s;
int getint(string p) {
  int res = 0;
  for (int j = 0; j < p.length(); j++)
    if (p[j] == '-')
      return -1;
    else {
      res = res * 10 + (p[j] - '0');
    }
  return res;
}
int cnt(int k) {
  string s1, s2;
  int res = 1, l = s.length();
  do {
    if (k <= l - 18) {
      s1 = s.substr(k, 10);
      s2 = s.substr(k + 8, 10);
    } else
      break;
    k += 8;
    if (s1 == s2)
      res++;
    else
      break;
  } while (1);
  return res;
}
int main() {
  cin >> s;
  int ans = -1;
  int m = 0, index;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '-' && i >= 2 && i <= s.length() - 4) {
      int k1 = getint(s.substr(i - 2, 2));
      int k2 = getint(s.substr(i + 1, 2));
      int k3 = getint(s.substr(i + 4, 4));
      if (k2 > 0 && k2 < 13)
        if (k1 > 0 && k1 <= w[k2])
          if (k3 >= 2013 && k3 <= 2015) {
            m = cnt(i - 2);
            if (ans < m) {
              ans = m;
              index = i;
            }
          }
    }
  s = s.substr(index - 2, 10);
  cout << s;
  return 0;
}
