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 Python (3.4.3) (judge verdict: Wrong Answer)

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return -1
 
a = input().split("#")
a = list(a[0])
judge = 0
A = []
B = []
 
A.append(my_index(a, 'k'))
if (my_index(a, 'k') != -1):
 a[ my_index(a, 'k') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'e'))
if (my_index(a, 'e') != -1):
 a[ my_index(a, 'e') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'y'))
if (my_index(a, 'y') != -1):
 a[ my_index(a, 'y') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'e'))
if (my_index(a, 'e') != -1):
 a[ my_index(a, 'e') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'n'))
if (my_index(a, 'n') != -1):
 a[ my_index(a, 'n') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'c'))
if (my_index(a, 'c') != -1):
 a[ my_index(a, 'c') ] = 'AAA'
 judge += 1
A.append(my_index(a, 'e'))
if (my_index(a, 'e') != -1):
 a[ my_index(a, 'e') ] = 'AAA'
 judge += 1
 
B = A
A.sort()
if( (A == B) and (judge==7) ):
 print('YES')
else:
 print("NO")