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;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		
		const string str = "keyence";
		if(s == str || s.StartsWith(str) || s.EndsWith(str))
		{
			Console.WriteLine("YES");
			return;
		}
		
		int kstart = 0;
		while(kstart < s.Length)
		{
			int kindex = s.IndexOf('k', kstart);
			int keyIndex = 0;
			if(kindex == -1)
				break;
			for(int i = kindex; i < str.Length; i++)
			{
				if(keyIndex < str.Length && s[i] == str[keyIndex])
				{
					keyIndex ++;
				}
				else
				{
					if(kindex == 0 && s.EndsWith(str.Substring(keyIndex)))
					{
						Console.WriteLine("YES");
						return;
					}
					break;
				}
				
				if( keyIndex == str.Length - 1 && (kindex == 0 || kindex == s.Length - str.Length))
				{
					Console.WriteLine("YES");
					return;
				}
			}
			kstart = kindex+1;
		}
		Console.WriteLine("NO");
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}