#include <bits/stdc++.h>
const char IN[] = "test.inp";
const char OUT[] = "test.out";
const long double PI = acos(-1.0);
const long double E = 2.718281828459045L;
using namespace std;
inline void open() {
  freopen(IN, "r", stdin);
  freopen(OUT, "w", stdout);
}
string s, x, y, z, t;
string a[100010];
map<string, int> mm;
map<string, int>::iterator it;
int main() {
  int n, i, j;
  open();
  cin >> s;
  n = s.length();
  for (i = 0; i < n - 9; i++) {
    z = "";
    x = "";
    y = "";
    t = "";
    for (j = i; j <= i + 9; j++) z = z + s[j];
    x = x + z[0] + z[1];
    y = y + z[3] + z[4];
    t = t + z[6] + z[7] + z[8] + z[9];
    if (z[2] == '-' && z[5] == '-')
      if (z[0] != '-')
        if (z[1] != '-')
          if (z[3] != '-')
            if (z[4] != '-')
              if (z[6] != '-')
                if (z[7] != '-')
                  if (z[8] != '-')
                    if (z[9] != '-')
                      if (t <= "2015" && t >= "2013") {
                        if (y == "01" || y == "03" || y == "05" || y == "07" ||
                            y == "08" || y == "10" || y == "12")
                          if (x <= "31" && x >= "01") mm[z]++;
                        if (y == "04" || y == "06" || y == "09" || y == "11")
                          if (x <= "30" && x >= "01") mm[z]++;
                        if (y == "02")
                          if (x <= "28" && x >= "01") mm[z]++;
                      }
  }
  string res;
  int m = 0;
  for (it = mm.begin(); it != mm.end(); it++)
    if (it->second > m) {
      res = it->first;
      m = it->second;
    }
  cout << res;
}
