#include <bits/stdc++.h>
using namespace std;
string s, ans;
map<string, int> smap;
map<string, int>::iterator it;
int main() {
  int i, j, k;
  cin >> s;
  int len = s.length();
  for (int i = (int)(0); i < (int)(len); i++) {
    if (i + 10 < len && s.at(i) != '-') {
      string t("");
      for (int j = (int)(0); j < (int)(10); j++) {
        t += s.at(i + j);
      }
      if (t.at(2) == t.at(5) && t.at(2) == '-') {
        int d, m, y;
        d = (t.at(0) - '0') * 10 + (t.at(1) - '0');
        m = (t.at(3) - '0') * 10 + (t.at(4) - '0');
        y = (t.at(6) - '0') * 1000 + (t.at(7) - '0') * 100 +
            (t.at(8) - '0') * 10 + (t.at(9) - '0');
        if (d == 31 &&
            (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 ||
             m == 12) &&
            (y >= 2013 && y <= 2015))
          smap[t]++;
        else if (d > 28 && m == 2)
          ;
        else if (d <= 30 && (y >= 2013 && y <= 2015))
          smap[t]++;
      }
    }
  }
  k = 0;
  for (it = smap.begin(); it != smap.end(); it++) {
    if (it->second > k) {
      k = it->second;
      ans = it->first;
    }
  }
  cout << ans;
  return 0;
}
