#include <bits/stdc++.h>
using namespace std;
void fun(int b, int d) {
  int u = 1;
  int v = 0;
  if ((b < 0 && d > 0) || (b > 0 && d < 0)) v = 1;
  b = abs(b);
  d = abs(d);
  if (b < d) {
    swap(b, d);
    u = 0;
  }
  int b1 = b, d1 = d;
  int x = b % d;
  while (x) {
    b = d;
    d = x;
    x = b % d;
  }
  if (u == 0) {
    if (v) d1 *= -1;
    cout << d1 / d << "/" << b1 / d;
  } else {
    if (v) b1 *= -1;
    cout << b1 / d << "/" << d1 / d;
  }
}
int po(int m, int i) {
  int r = 1;
  while (i--) {
    r *= m;
  }
  return r;
}
int to_int(string s) {
  int res = 0;
  for (unsigned int i = 0; i < s.size(); i++) res = res * 10 + s[i] - '0';
  return res;
}
int main() {
  string s;
  cin >> s;
  map<string, int> m;
  int v[13];
  v[0] = -1, v[1] = 31, v[2] = 28, v[3] = 31, v[4] = 30, v[5] = 31, v[6] = 30,
  v[7] = 31, v[8] = 31, v[9] = 30, v[10] = 31, v[11] = 30, v[12] = 31;
  int r = 1;
  for (unsigned int i = 0; i < s.size() - 10; i++) {
    r++;
    if (isdigit(s[i]) && isdigit(s[i + 1]) && !isdigit(s[i + 2]) &&
        isdigit(s[i + 3]) && isdigit(s[i + 4]) && !isdigit(s[i + 5]) &&
        isdigit(s[i + 6]) && isdigit(s[i + 7]) && isdigit(s[i + 8]) &&
        isdigit(s[i + 9])) {
      int day = to_int(s.substr(i, 2));
      int mo = to_int(s.substr(i + 3, 2));
      int ye = to_int(s.substr(i + 6, 4));
      if (ye <= 2015 && ye >= 2013 && mo <= 12 && mo >= 1 && day > 0) {
        if (day <= v[mo]) m[s.substr(i, 10)]++;
      }
    }
  }
  string ans;
  int max1 = 0;
  map<string, int>::iterator it = m.begin();
  while (it != m.end()) {
    if (it->second > max1) {
      max1 = it->second;
      ans = it->first;
    }
    it++;
  }
  cout << ans;
  return 0;
}
