import datetime
import re
import collections
p = re.compile('([0-9]{2})-([0-9]{2})-([0-9]{4})')
data = raw_input()
result = collections.defaultdict(int)
i = 0
s = datetime.date(2013,1,1)
e = datetime.date(2015,12,31)
while i < len(data):
  m = p.search(data, i)
  if m:
    try:
      if s <= datetime.date(*map(int, reversed(m.groups()))) <= e:
        result[data[m.start():m.end()]] += 1
    except:
      pass
    finally:
      i = m.start()+1
  else:
    break

k,v = sorted({v:k for k,v in result.iteritems()}.items(), reverse=True)[0]
print v

