
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Vector;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author KHALED
 */
public class AncientProphesy {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String s=scan.next();
        HashMap<String, Integer>map=new HashMap<String, Integer>();
        int max=0;
        String out="";
        for (int i = 0; i < s.length()-9; i++) 
        {
            String s1=s.charAt(i)+""+s.charAt(i+1);
            String s2=s.charAt(i+3)+""+s.charAt(i+4);
            String s3=s.charAt(i+6)+""+s.charAt(i+7)+s.charAt(i+8)+""+s.charAt(i+9);
            if(!s1.contains("-")&&!s2.contains("-")&&!s3.contains("-")
                    &&s.charAt(i+2)=='-'&&s.charAt(i+5)=='-')
            {
                int k1=Integer.parseInt(s1);
                int k2=Integer.parseInt(s2);
                int k3=Integer.parseInt(s3);
                if(((k2==1||k2==3||k2==5||k2==7||k2==8||k2==10||k2==12)&&k1>0&&k1<=31)||
                        ((k2==4||k2==6||k2==9||k2==11)&&k1>0&&k1<=30)||((k2==2)&&k1>0&&k1<=28))
                {
                    String h=s1+"-"+s2+"-"+s3;
                    if(map.containsKey(h))
                        map.put(h, map.get(h)+1);
                    else
                        map.put(h, 1);
                    if(map.get(h)>=max)
                    {
                        max=map.get(h);
                        out=h;
                    }                        
                }
            }
        }
        System.out.println(out);
//        for(Map.Entry<String, Integer>entry : map.entrySet())
//        {
//            System.out.println(entry.getKey()+"  "+entry.getValue());
//        }
    }
}
