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: Accepted)

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 <= S.Length; i++)
            {
                for(int j= 0; j <= S.Length-i; j++)
                {
                    string fpart = S.Substring(0, i);

                    string lpart = S.Substring(i+j, S.Length-i-j);


                    if(fpart + lpart == K) {
                        Console.WriteLine("YES");
                        return;
                    }

                }
            }
/*
            if (S.IndexOf(K,0)==0 || S.IndexOf(K, S.Length - K.Length) >= 0)
            {
                Console.WriteLine("YES");
                return;
            }
            for (int i = 0; i < Klst.Count(); i++)
            {
                int fstidx = S.IndexOf(K.Substring(0,i+1));
                int residx = S.IndexOf(K.Substring(i+1, K.Length - (i + 1)), fstidx + i + 1);
                int lastidx = residx + K.Length - (i + 1);
                
                if (fstidx >= 0 &&  residx >= 0&&  fstidx == 0 && lastidx == S.Length)
                {
                    ans = "YES";

                }

            }
            */           
            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;//最後の素数も返す
        }




    }

}