
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Hashtable;
import java.util.StringTokenizer;

public class B
{
    public static void main(String[] args) throws IOException
    {
        int my[] =
        { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        InputB in = new InputB();
        char[] w = in.next().replace("-", "").toCharArray();
        E ans = new E(0, 0, 0);
        Hashtable<E, Integer> h = new Hashtable<E, Integer>();
        for (int i = 0; i + 8 < w.length; i++)
        {
                        
            int d = new Integer(w[i] + "" + w[i + 1]);
            int m = new Integer(w[i + 2] + "" + w[i + 3]);
            int y = new Integer(w[i + 4] + "" + w[i + 5] + "" +  w[i + 6] + "" + w[i + 7]);
            if (!(y == 2013 || y == 2014 || y == 2015))
                continue;
            if (m > 12 || m == 0)
                continue;
            if (d > my[m - 1])
                continue;
            E t = new E(d, m, y);
            if (h.containsKey(t))
            {
                h.put(t, h.get(t) + 1);
                if (h.get(t) > ans.o)
                {
                    ans = t;
                    ans.o = h.get(t);
                }
            } else{
                h.put(t, 1);
                if (h.get(t) > ans.o)
                {
                    ans = t;
                    ans.o = h.get(t);
                }
    
            }
        }
        for (int i = w.length - 1; i - 8 >=  0; i--)
        {
                        
            int y = new Integer(w[i - 3] + "" + w[i - 2] + "" + w[i - 1] + "" + w[i]);
            int m = new Integer(w[i - 5] + "" + w[i - 4]);
            int d = new Integer(w[i - 7] + "" + w[i - 6]);
            if (!(y == 2013 || y == 2014 || y == 2015))
                continue;
            if (m > 12 || m == 0)
                continue;
            if (d > my[m - 1])
                continue;
            E t = new E(d, m, y);
            if (h.containsKey(t))
            {
                h.put(t, h.get(t) + 1);
                if (h.get(t) > ans.o)
                {
                    ans = t;
                    ans.o = h.get(t);
                }
            } else{
                h.put(t, 1);
                if (h.get(t) > ans.o)
                {
                    ans = t;
                    ans.o = h.get(t);
                }
    
            }
        }

        String d =  ans.d + "-";
        if(d.length() == 2)
            d = "0" + d;
        if((ans.m + "").length() == 1)
            d = d + "0" + ans.m + "-";
        else
            d = d + ans.m + "-";
        d += ans.y + "";
        System.out.println(d);
    }
}


class E
{
    int d;
    int m;
    int y;
    int o;

    public E(int d, int m, int y)
    {
        this.d = d;
        this.m = m;
        this.y = y;
        o = 0;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + d;
        result = prime * result + m;
        result = prime * result + y;
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        E other = (E) obj;
        if (d != other.d)
            return false;
        if (m != other.m)
            return false;
        if (y != other.y)
            return false;
        return true;
    }
}

class InputB
{
    BufferedReader bf;
    StringTokenizer st;

    public InputB() throws IOException
    {
        bf = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(bf.readLine());
    }

    public String next() throws IOException
    {
        while (!st.hasMoreTokens() && bf.ready())
        {
            st = new StringTokenizer(bf.readLine());
        }
        return st.hasMoreTokens() ? st.nextToken() : null;
    }

    public boolean hasNext() throws IOException
    {
        while (!st.hasMoreTokens() && bf.ready())
        {
            st = new StringTokenizer(bf.readLine());
        }
        return st.hasMoreTokens();
    }

    public int nextInt() throws IOException
    {
        while (!st.hasMoreTokens() && bf.ready())
        {
            st = new StringTokenizer(bf.readLine());
        }
        return st.hasMoreTokens() ? new Integer(st.nextToken()) : 0;

    }
}
