#include <bits/stdc++.h>
using namespace std;
char s[1000100];
int pos[77][22][2222];
int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool numb(char c) { return c >= '0' && c <= '9'; }
int main() {
  gets(s);
  int len = strlen(s);
  s[len] = '-';
  for (int i = 0; i < len; i++) {
    if (s[i] == '-' && s[i + 5] == '-') {
      int res = 0;
      bool is = true;
      for (int j = i + 1; j < i + 5; j++)
        if (s[j] >= '0' && s[j] <= '9') {
          res = (res * 10) + (s[j] - '0');
        } else
          is = false;
      if (is && res >= 2013 && res < 2016) {
        int mn = -1;
        if (numb(s[i - 1]) && numb(s[i - 2]))
          mn = (s[i - 2] - '0') * 10 + (s[i - 1] - '0');
        int dy = -1;
        if (numb(s[i - 4]) && numb(s[i - 5]))
          dy = (s[i - 5] - '0') * 10 + (s[i - 4] - '0');
        if (mn == -1 || dy == -1 || s[i - 3] != '-') continue;
        if (mn > 0 && mn < 13 && mon[mn] >= dy && dy > 0) pos[dy][mn][res]++;
      }
    }
  }
  int dy1 = 1, mn1 = 12, yr1 = 2013, ans = -1;
  for (int j = 1; j < 13; j++)
    for (int i = 1; i <= mon[i]; i++)
      for (int t = 2013; t < 2016; t++)
        if (ans < pos[i][j][t]) {
          ans = pos[i][j][t];
          dy1 = i;
          mn1 = j;
          yr1 = t;
        }
  printf("%02d-%02d-%d", dy1, mn1, yr1);
}
