#include <bits/stdc++.h>
using namespace std;
double const eps = 1e-6;
const int inf = 0x3fffffff;
const int size = 100000 + 5;
map<string, int> cnt;
int tmp[7] = {1, 3, 5, 7, 8, 9, 12};
bool check(string str) {
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '-' && i != 2 && i != 5) return false;
  }
  const char *s = str.c_str();
  int d, m, y;
  sscanf(s, "%d-%d-%d", &d, &m, &y);
  if (y > 2015 || y < 2013) return false;
  if (m < 1 || m > 12) return false;
  if (d < 1 || d > 31) return false;
  if (d < 31) return true;
  for (int i = 0; i < 7; i++)
    if (m == tmp[i]) return true;
  return false;
}
bool take(string str, int i) {
  string a;
  if (i <= 1) return false;
  if (i - 2 + 10 >= (int)str.size()) return false;
  string ss = str.substr(i - 2, 10);
  if (check(ss)) {
    if (cnt.find(ss) == cnt.end())
      cnt[ss] = 0;
    else
      cnt[ss]++;
  }
}
int main() {
  string str;
  cin >> str;
  for (int i = 0; i < str.size(); i++)
    if (str[i] == '-') {
      take(str, i);
    }
  string ans;
  int mx = 0;
  for (map<string, int>::const_iterator iter = cnt.begin(); iter != cnt.end();
       ++iter) {
    string key = iter->first;
    int value = iter->second;
    if (value > mx) {
      mx = value;
      ans = key;
    }
  }
  cout << ans << endl;
  return 0;
}
