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: Runtime Error)

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P =pair<int,int>;
int main(){
	string S;
	cin>>S;
	if(S=="keyence"){
		cout<<"YES"<<endl;
		return 0;
	}
	for(int i=0;i<=S.size()-1;i++){
		for(int j=0;j<=S.size()-1-i;j++){
			S.erase(S.at(i),S.at(j));
			if(S=="keyence"){
				cout<<"YES"<<endl;
			}
		}
	}
	cout<<"NO"<<endl;
	
return 0;}

/*compile
g++ code.cpp
./a.out
run*/
/*int a=0,b=0,c=0;
	rep(i,S.size()){
		if(a==0&&S.at(i)=='k'){
			a++;
			b=1;
		}else if(a==1&&S.at(i)=='e'){
			a++;
			b=1;
		}else if(a==2&&S.at(i)=='y'){
			a++;
			b=1;
		}else if(a==3&&S.at(i)=='e'){
			a++;
			b=1;
		}else if(a==4&&S.at(i)=='n'){
			a++;
			b=1;
		}else if(a==5&&S.at(i)=='c'){
			a++;
			b=1;
		}else if(a==6&&S.at(i)=='e'){
			a++;
			b=1;
		}else{}
		if(S.at(i)=='k'||S.at(i)=='e'||S.at(i)=='y'||S.at(i)=='k'||S.at(i)=='k'||)
	}*/