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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/*
 * Author: ylx
 * Lang: c++
 * Prog: b
 */
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline int read()
{
	char s;
	int k=0,base=1;
	while ((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
	if (s==EOF) exit(0);
	if (s=='-') base=-1,s=getchar();
	while (isdigit(s)) k=k*10+(s^'0'),s=getchar();
	return k*base;
}
inline void write(ll x)
{
	static char cnt,num[20];cnt=0;
	if (!x)
	{
		putchar('0');
		return;
	}
	for (;x;x/=10) num[++cnt]=x%10;
	for (;cnt;putchar(num[cnt--]+48));
}
const int maxn=110;
const char *s="keyence";
char a[maxn];
int n;
int main()
{
#ifdef ylx
	freopen("b.in","r",stdin);
	freopen("b.out","w",stdout);
#endif
	scanf("%s",a);
	n=strlen(a);
	int p1=0,p2=6;
	for (int i=0;i<n;i++)
	{
		if (a[i]==s[p1]) ++p1;
		if (p1==7) break;
	}
	for (int i=n-1;i>=0;i--)
	{
		if (a[i]==s[p2]) --p2;
		if (p2==-1) break;
	}
	if (p2<=p1)
	{
		printf("YES");
	} else
	{
		printf("NO");
	}
	return 0;
}
//2019年 01月 24日 星期四 16:48:37 CST