Problem:
Score : 200 points

Problem Statement

A string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.

Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.

Constraints

The length of S is between 7 and 100 (inclusive).

S consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S is a KEYENCE string, print YES; otherwise, print NO.

Sample Input 1

keyofscience

Sample Output 1

YES

keyence is an abbreviation of key of science.

Sample Input 2

mpyszsbznf

Sample Output 2

NO

Sample Input 3

ashlfyha

Sample Output 3

NO

Sample Input 4

keyence

Sample Output 4

YES

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;

namespace KPCB
{
    static class MainClass
    {

        public static void Main(string[] args)
        {
            string S = Console.ReadLine();

            string K = "keyence";
            var Klst = new List<string>(7) { "k", "e", "y", "e", "n", "c", "e" };

            string ans = "NO";
            for(int i = 0; i < Klst.Count(); i++)
            {
                int idx = S.IndexOf(K.Substring(0,i+1));
                if (idx >= 0&& S.IndexOf(K.Substring(i + 1, K.Length - (i + 1)), idx + 1) >= idx) 
                {
                    ans = "YES";
                    //Console.WriteLine("idx: " + idx + " Klst[i]: " + Klst[i]);
                }

            }
            Console.WriteLine(ans);

            return;


        }



        public static long Gcd(long a, long b)
        {
            long tmp;
            // a<bにする
            if (a >= b)
            {
                tmp = a;
                a = b;
                b = tmp;
            }

            if (a == 0)
            {
                return b;
            }

            tmp = a;
            a = b % a;
            b = tmp;
            return Gcd(a, b);

        }


        public static IEnumerable<long> PF(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n) //※1
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;//最後の素数も返す
        }




    }

}