#include <bits/stdc++.h>
using namespace std;
int a[30000];
int x[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  string f;
  while (cin >> f) {
    memset(a, 0, sizeof(a));
    int p = 1;
    int y, m, d;
    int q = 1;
    for (int i = 0; i < f.size() - 10; i++) {
      string T = "";
      T.assign(f, i, 10);
      if (T[2] != '-' || T[5] != '-') continue;
      for (int j = 0; j < 10; j++) {
        if (j == 2 || j == 5) continue;
        if (T[j] < '0' || T[j] > '9') {
          q = 0;
          break;
        }
      }
      m = (T[3] - '0') * 10 + (T[4] - '0');
      if (m > 12 || m < 1) {
        q = 0;
        continue;
      }
      d = (T[0] - '0') * 10 + (T[1] - '0');
      if (d < 1 || d > x[m]) {
        q = 0;
        continue;
      }
      y = (T[6] - '0') * 1000 + (T[7] - '0') * 100 + (T[8] - '0') * 10 +
          (T[9] - '0');
      if (y < 2013 || y > 2015) {
        q = 0;
        continue;
      }
      a[(y - 2013) * 10000 + m * 100 + d]++;
    }
    int max = 0, k = 0;
    for (int i = 99; i < 30000; i++)
      if (a[i] > max) {
        max = a[i];
        k = i;
      }
    d = k % 100;
    m = (k / 100) % 100;
    y = k / 10000 + 2013;
    if (d < 10) cout << 0 << endl;
    cout << d << '-';
    if (m < 10) cout << 0;
    cout << m << '-';
    cout << y << endl;
  }
  return 0;
}
