#include <bits/stdc++.h>
using namespace std;
string a;
string b;
string c;
int main() {
  cin >> a;
  int max = 0;
  int t;
  map<string, int> m;
  for (int i = 0; i < a.length(); i++) {
    if (a[i + 6] == '2' && a[i + 7] == '0' && a[i + 8] == '1' &&
            a[i + 9] == '3' ||
        a[i + 9] == '4' || a[i + 9] == '5') {
      if (a[i + 5] == '-' && a.substr(i + 3, 2) >= "01" &&
          a.substr(i + 3, 2) <= "12" && a[i + 2] == '-') {
        if (a.substr(i + 3, 2) == "01" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "02" && a.substr(i, 2) <= "28" ||
            a.substr(i + 3, 2) == "03" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "04" && a.substr(i, 2) <= "30" ||
            a.substr(i + 3, 2) == "05" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "06" && a.substr(i, 2) <= "30" ||
            a.substr(i + 3, 2) == "07" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "08" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "09" && a.substr(i, 2) <= "30" ||
            a.substr(i + 3, 2) == "10" && a.substr(i, 2) <= "31" ||
            a.substr(i + 3, 2) == "11" && a.substr(i, 2) <= "30" ||
            a.substr(i + 3, 2) == "12" && a.substr(i, 2) <= "31") {
          m[a.substr(i, 10)]++;
          b += a.substr(i, 10);
        }
      }
    }
  }
  for (int i = 0; i < b.length() / 10; i += 10) {
    if (m[b.substr(i, 10)] < m[b.substr(i + 10, 10)]) {
      c = b.substr(i + 10, 10);
    } else {
      c = b.substr(i, 10);
    }
  }
  cout << c << endl;
  return 0;
}
