#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re


text = raw_input()

all_matches = re.findall('(?=(\d\d-\d\d-\d\d\d\d))', text)

days_in_month = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

date = ''
date_cout = 0

for result in set(all_matches):
    y, m, d = int(result[6:10]), int(result[3:5]), int(result[0:2])
    
    if y<2013 or y>2015:
        continue
    if m<1 or m>12:
        continue
    if d<1 or d>days_in_month[m]:
        continue;

    if all_matches.count(result) > date_cout:
        date = result
        date_cout = all_matches.count(result)

print date
