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 (Python):
import math as mt
import itertools as it
import functools as ft
import random as rnd

stdin = lambda type_ = "int", sep = " ": list(map(eval(type_), input().split(sep)))
joint = lambda sep = " ", *args: sep.join(str(i) if type(i) != list else sep.join(map(str, i)) for i in args)

s = input()

if len(s) < 7:
    print('NO')
else:
    for i in range(0, 8):
        if s[:i] + s[-7 + i:] == 'keyence':
            print('YES')
            exit(0)
    print("NO")

Solution (Python):
S = input()
ans = 'keyence'

if S[0] == 'k':
    flag = True
    for i in range(1, 7):
        if S[i] != ans[i]:
            flag = False
            break
    if flag:
        print('YES')

    else:
        if ans[i:] == S[-len(ans[i:]):]:
            print('YES')
        else:
            print('NO')
else:
    if S[-7:] == ans:
        print('YES')
    else:
        print('NO')

Solution (Python):
import sys
s = input()
for i in range(len(s)):
    for j in range(len(s) - i):
        if s[:i] + s[-j:] == "keyence":
            print("YES")
            sys.exit()
print("NO")

Solution (Python):
import copy
S = str(input())
s = list(S)
L = len(s)
break2 = 0
text = ""
for i in range(L):
    j = 0
    for j in range(L):
        t = copy.deepcopy(s)
        del t[i:j+1]
        text = "".join(t)
        if text == "keyence":
            print("YES")
            break2 = 1
            break
        else:
            pass
    if break2 == 1:
        break
if break2 == 0:
    print("NO")

Solution (Python):
def main():
    S = input()
    keyence = 'keyence'

    i = 0
    while True:
        if S[i] != keyence[i]:
            break

        if i == len(keyence) - 1:
            print("YES")
            return

        i += 1

    res = len(keyence) - i

    i = -res
    while True:
        if S[i] != keyence[i]:
            print("NO")
            return

        if i == -1:
            print("YES")
            return

        i += 1

if __name__ == '__main__':
    main()

Solution (Python):
S = input()

w = 'keyence'
l = len(w)
flag = False
for i in range(l):
	f = w[:i]
	b = w[-(l-i):]
	sf = S[:i]
	sb = S[-(l-i):]
	if f == sf and b == sb:
		print('YES')
		flag = True
		break

if not flag:
	print('NO')

Solution (Python):
S = input()
ch = 'keyence'
for i in range(len(ch)+1):
    ch1 = ch[:i]
    ch2 = ch[i:]

    if ch1 == S[:i] and ch2 == S[-len(ch2):]:
        print('YES')
        exit()
print('NO')

Solution (Python):
S = input()

head = 0
back = 0

key = 'keyence'

for i in range(len(key)):
    if S[:i+1] == key[:i+1]:
        head = i+1

for i in range(len(key)):
    if S[len(S)-i-1:] == key[len(key)-i-1:]:
        back = i+1

if head + back >= len(key):
    print("YES")
else:
    print("NO")

Solution (Python):
def main():
    S = input()
    lenS = len(S)
    for i in range(lenS):
        for j in range(i, lenS):
            ss = S[0:i+1] + S[j+1:lenS]
            if ss == "keyence":
                return "YES"
    return "NO"

if __name__ == "__main__":
    print(main())

Solution (Python):
import sys

S=input()

L="keyence"

for i in range(7):
    if L[:i]==S[:i] and L[i:]==S[-(7-i):]:
        print("YES")
        break

else:
    print("NO")

Solution (Python):
S =input()
q = 'keyence'
ans = ('NO')
if q in S:
    ans ='YES'
for i in range(7):
    if S[:i] == q[:i] and S[-(7-i):] == q[-(7-i):]:
        ans = 'YES'
print(ans)

Solution (Python):
s = input()
i = 0
key = "keyence"
while i < 7:
    if s[i] == key[i]:
        i += 1
    else:
        break
    if i == 7:
        print("YES")
        exit()

if s[:i] + s[-7+i:] == key:
    print("YES")
else:
    print("NO")

Solution (Python):
def has_keyence(S):
    if S.startswith('keyence'):
        return 'YES'
    elif S.endswith('keyence'):
        return 'YES'
    else:
        check = [['k', 'eyence'],
                 ['ke', 'yence'],
                 ['key', 'ence'],
                 ['keye', 'nce'],
                 ['keyen', 'ce'],
                 ['keyenc', 'e']]
        for c in check:
            if S.startswith(c[0]) and S.endswith(c[1]):
                return 'YES'
    return 'NO'

S = input()
print(has_keyence(S))

Solution (Python):
S = input()

keyence = 'keyence'

ans = 'NO'
if S[0] != 'k':
    if S[-7:] == keyence:
        ans = 'YES'

for i in range(7):
    if S[:i] == keyence[:i]:
        if S[i-7:] == keyence[i-7:]:
            ans = 'YES'

print(ans)

Solution (Python):
s = "keyence"
s1 = raw_input()
ans = "NO"
for i in range(len(s)):
	fhalf = s[:i]
	shalf = s[i:]
	if s1[0:len(fhalf)] == fhalf and s1[len(s1) - len(shalf):] == shalf:
		ans = "YES"
print ans

Solution (Python):
def is_keyence(s):
    n = len(s)

    for i in range(n-1):
        for j in range(i, n):
            t = s[:i] + s[j:]
            if t == "keyence":
                print ("YES")
                return

    print ("NO")

S = input()
is_keyence(S)

Solution (Python):
s=input()
if s[len(s)-7:len(s)]=='keyence':
    print('YES')
elif s[0:1]=='k' and s[len(s)-6:len(s)]=='eyence':
  print('YES')
elif s[0:2]=='ke' and s[len(s)-5:len(s)]=='yence':
  print('YES')
elif s[0:3]=='key' and s[len(s)-4:len(s)]=='ence':
  print('YES')
elif s[0:4]=='keye' and s[len(s)-3:len(s)]=='nce':
  print('YES')
elif s[0:5]=='keyen' and s[len(s)-2:len(s)]=='ce':
  print('YES')
elif s[0:6]=='keyenc' and s[len(s)-1:len(s)]=='e':
  print('YES')
elif s[0:7]=='keyence':
  print('YES')
else:
  print('NO')

Solution (Python):
S = input()
ans = "NO"
N = len(S)

for i in range(N):
    for j in range(i, N + 1):
        tmp = (S[:i] + S[j:])
        if tmp == "keyence":
            ans = "YES"

print(ans)

Solution (Python):
s = input()
length = len(s)
def check():
    for i in range(length):
        for j in range(i + 1, length):
            if s[:i + 1] + s[j:] == "keyence":
                print("YES")
                return
    print("NO")
check()

Solution (Python):
test = "keyence"
S = input()

isOk = False

for k in range(8):
    if k == 0:
        temp = S[-7:]
    elif k == 7:
        temp = S[:7] 
    else:
        temp = (S[0:k] + S[-(7 - k):])
    if temp == test:
        isOk = True

if isOk:
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()
key = 'keyence'
for i in range(len(key) + 1):
  pre = key[:i]
  post = key[i:]
  p = len(S) - len(key) + i
  if S[:i] == pre and S[p:] == post:
    print('YES')
    break
else:
  print('NO')

Solution (Python):
N = str(input())   




for i in range(len(N)):
    for j in range(i,len(N)):
        if N[0:i] + N[j:len(N)] == "keyence":
            print("YES")
            exit()
print("NO")

Solution (Python):

from itertools import product
S = input()
cur = 0
ans = False
for i, j in product(range(len(S)), range(len(S))):
    if i >= j:
        continue
    if S[:i] + S[j:] == 'keyence':
        ans = True
print(['NO', 'YES'][ans or S == 'keyence'])

Solution (Python):
KEYENCE = 'keyence'
S = input()
ans = False
for i in range(len(KEYENCE)):
    if S.startswith(KEYENCE[:i]) and S.endswith(KEYENCE[i:]):
        ans = True
        break
if ans:
    print('YES')
else:
    print('NO')

Solution (Python):
S = input()
k = 'keyence'
for l in range(len(S)+1):
    for i in range(len(S) - l+1):
        s = S[:i] + S[i+l:]
        if s == k:
            print('YES')
            exit()
print('NO')

Solution (Python):

s = input()
k = "keyence"

pre = None
for i in range(1,7+1):
    if s[:i]==k[:i]:
        pre = i

if pre is None:
    print("NO")
elif pre==7:
    print("YES")
elif k[pre:]==s[-(7-pre):]:
    print("YES")
else:
    print("NO")

Solution (Python):
s = input().strip()

if s[:7]=="keyence" or s[0]+s[-6:]=="keyence" or s[:2]+s[-5:]=="keyence" or s[:3]+s[-4:]=="keyence" or s[:4]+s[-3:]=="keyence" or s[:5]+s[-2:]=="keyence" or s[:6]+s[-1]=="keyence" or s[-7:]=="keyence":
  print("YES")
else:
  print("NO")

Solution (Python):
Ss = input()

for i in range(8):
    if Ss[:i] + Ss[-7+i:] == 'keyence':
        print('YES')
        break
else:
    print('NO')

Solution (Python):

def main():
    buf = input()
    S = buf
    if S[0:len("keyence")] == "keyence" or S[len(S)-len("keyence"):len(S)] == "keyence":
        print("YES")
        return
    for i in range(len("keyence")):
        if S[0:i] == "keyence"[0:i] and S[len(S)-(len("keyence")-i):len(S)] == "keyence"[i:len("keyence")]:
            print("YES")
            return
    print("NO")

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
N = len(S)

judge = "NO"
for i in range(N):
	for j in range(i, N + 1):
		if S[0:i] + S[j:] == "keyence":
			judge = "YES"

print(judge)

Solution (Python):
def main():
    S = input()
    keyence = "keyence"
    for i in range(len(keyence)+1):
        if S.startswith(keyence[:i]) and S.endswith(keyence[i:]):
            print("YES")
            return
    print("NO")
    return


if __name__ == "__main__":
    main()

Solution (Python):
import sys
S = input()
N = len(S)
t = 'keyence'
for i in range(8):
    if S[0:i] == t[0:i] and S[N-7+i:N] == t[i:]:
        print('YES')
        sys.exit()
print('NO')

Solution (Python):
s = str(input())
n = len(s)
isAble = False
for i in range(n):
    for j in range(i,n):
            if s[:i]+s[j:]=="keyence":
                isAble = True
                break
if isAble:
    print("YES")
else:
    print('NO')

Solution (Python):
import numpy as np

s = input()
if s == 'keyence':
    print('YES')
    exit()

for i in range(0,len(s)):
    for j in range(len(s)):
        tmp = s[:i] + s[j:]
        if tmp=='keyence':
            print('YES')
            exit()
print('NO')

Solution (Python):



def main():
    S = input()
    l = len(S)
    r = "keyence"
    for i in range(min(l, 7)):
        if S[i] != r[i]: break
    for j in range(1, min(l, 7) + 1):
        if S[-j] != r[-j]: break
    j -= 1
    return i + j >= 7


if __name__ == "__main__":
    print(["NO", "YES"][main()])

Solution (Python):
t="keyence"
S=input()
def judge(S):
    for i in range(7):
        if S[i]!=t[i]:
            for j,s in zip(range(6,i-1,-1),S[i:][::-1]):
                if t[j]!=s: return False
    return True
print(["NO","YES"][judge(S)])

Solution (Python):
s=input()
for i in range(len(s)):
    if(i>7):
        continue
    if(s[:i]+s[-(7-i):]=="keyence"):
        print("YES")
        exit()
print("NO")

Solution (Python):
s = input()

if s[0] != 'k':
    if s[-7:] == 'keyence':
        print('YES')
    else:
        print('NO')
elif s[0] == 'k' and s[1] != 'e':
    if s[-6:] == 'eyence':
        print('YES')
    else:
        print('NO')
elif s[0:2] == 'ke' and s[2] != 'y':
    if s[-5:] == 'yence':
        print('YES')
    else:
        print('NO')
elif s[0:3] == 'key' and s[3] != 'e':
    if s[-4:] == 'ence':
        print('YES')
    else:
        print('NO')
elif s[0:4] == 'keye' and s[4] != 'n':
    if s[-3:] == 'nce':
        print('YES')
    else:
        print('NO')
elif s[0:5] == 'keyen' and s[5] != 'c':
    if s[-2:] == 'ce':
        print('YES')
    else:
        print('NO')
elif s[0:6] == 'keyenc' and s[5] != 'e':
    if s[-1] == 'e':
        print('YES')
    else:
        print('NO')
elif s[0:7] == 'keyence':
    print('YES')

Solution (Python):
s = input()
ans=False
for i in range(1, 8):
    if s[0:i]+s[len(s)-(7-i):len(s)]=='keyence':ans=True
print('YES' if ans else 'NO')

Solution (Python):
s= input()
ans ='NO'
query ='keyence'
for i in range(len(s)):
 for j in range(i,len(s)):
  judge =  s[0:i]+s[j::]
  if judge == query:
   ans ='YES'
print(ans)

Solution (Python):
import sys
s = input()
for i in range(len(s)):
    for j in range(i, len(s)+1):
        a = s[:i]+s[j:]
        if a=="keyence":
            print("YES")
            sys.exit()
print("NO")

Solution (Python):
s = input()
for i in range(7):
  if s[:i] + s[(len(s)-7+i):] == "keyence":
    print("YES")
    break
else:
  print("NO")

Solution (Python):
S = input()
L = len(S)
ans = "NO"
for i in range(8):
    if S[:i] + S[i-7:] == "keyence":
        ans = "YES"
print(ans)

Solution (Python):
import itertools

S = input()
if S == 'keyence':
    print("YES")
else:
    cands = [S[:i]+S[j:] for i, j in itertools.combinations(range(len(S)), 2)]
    if 'keyence' in cands:
        print("YES")
    else:
        print("NO")

Solution (Python):
S = input()
l = len(S)
for f in range(l+1):
  for t in range(f, l+1):
    if S[:f] + S[t:] == 'keyence':
      print('YES')
      exit()
print('NO')

Solution (Python):
S = input()
length = len(S)
ans = 'NO'
for i in range(length):
    for j in range(i, length + 1):
        s = S[:i] + S[j:]
        if s == 'keyence':
            ans = 'YES'
            break
    else:
        continue
    break
print(ans)

Solution (Python):
S = input()
ans = 'NO'
for i in range(len(S)+1):
    for j in range(i,len(S)+1):
        s1 = S[:i]
        s2 = S[j:]
        if s1+s2 == 'keyence':
            ans = 'YES'
print(ans)

Solution (Python):

S = input()
compare = "keyence"
j = -1
for i in range(7):
    if S[i] != compare[i]:
        j = i
        break
if j >= 0:
    if S[-(7-j):] == compare[-(7-j):]:
        print("YES")
    else:
        print("NO")
else:
    print("YES")

Solution (Python):
s_all = input()

for i in range(8):
    if i < 7:
        if s_all[:i] + s_all[-(7-i):] == "keyence":
            print("YES")
            break
    else:
        if s_all[:i] == "keyence":
            print("YES")
            break
else:
    print("NO")

Solution (Python):
s = input()
n = len(s)
for i in range(n):
    for j in range(i, n):
        t = s[:i] + s[j:]
        if t == "keyence":
            print("YES")
            exit()

print("NO")

Solution (Python):
import re


S = input()

if re.match('^keyence$', S):
    print('YES')
elif re.match('^(.+)keyence$', S):
    print('YES')
elif re.match('^k(.+)eyence$', S):
    print('YES')
elif re.match('^ke(.+)yence$', S):
    print('YES')
elif re.match('^key(.+)ence$', S):
    print('YES')
elif re.match('^keye(.+)nce$', S):
    print('YES')
elif re.match('^keyen(.+)ce$', S):
    print('YES')
elif re.match('^keyenc(.+)e$', S):
    print('YES')
elif re.match('^keyence(.+)$', S):
    print('YES')
else:
    print('NO')

Solution (Python):
S = input()
key = 'keyence'
for i in range(7):
    x = key[:i]
    y = key[i:]
    if S[:i] == x and S[-7+i:] == y:
        print('YES')
        exit()
print('NO')

Solution (Python):
p, s = input(), "keyence"
n = len(s)
ok = False
for i in range(n):
    if p.startswith(s[:i]) and p.endswith(s[i:]):
        ok = True
        break
print("YES" if ok else "NO")

Solution (Python):
s = input()
res = False
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[:i]+s[j:] == "keyence":
            res = True

if res:
    print('YES')
else:
    print('NO')

Solution (Python):
s = input()

for i in range(len(s)):
    for j in range(i, len(s)+1):
        if s[:i] + s[(j):] == "keyence":
            print("YES");
            exit(0);

print("NO");

Solution (Python):
S = input()
k = "keyence"
n = 0
ans = False
for i in range(8):
    if i==0:
        if S[-7:] == k:
            ans = True
    elif i==7:
        if S[:7]==k:
            ans = True
    else:
        if S[:i]==k[:i] and S[-(7-i):]==k[-(7-i):]:
            ans = True
if ans:
    print("YES")
else:
    print("NO")

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

S = input()


def solve(S):
    remove = len(S) - 7
    if remove == 0:
        return S == 'keyence'
    for i in range(len(S) - remove + 1):
        T = S[:i] + S[i+remove:]
        if T == 'keyence':
            return True
    return False
    
if solve(S):
    print('YES')
else:
    print('NO')

Solution (Python):
S = input()
for i in range(7):
	if S[:i] + S[i - 7:] == "keyence":
		print("YES")
		break
else:
	print("NO")

Solution (Python):
S = input()
N = len(S)
for i in range(N + 1):
    for j in range(N + 1):
        tmp = S[:i] + S[j:]
        if tmp == 'keyence':
            print('YES')
            exit()

print('NO')

Solution (Python):
s = raw_input().strip()
t = 'keyence'
for i in xrange(7):
    if s[i] != t[i]:
        break
else:
    i = 8
for j in xrange(7):
    if s[-j-1] != t[-j-1]:
        break
else:
    j = 8
print "YES" if i + j >= 7 else "NO"

Solution (Python):

from sys import stdin


s_in = lambda: stdin.readline()[:-1]  
d_in = lambda: int(stdin.readline())  
ds_in = lambda: list(map(int, stdin.readline().split()))  


S = s_in()

keyence = 'keyence'
idx = 0
flag = False
for i in range(len(keyence)):
    if S[:i] + S[i-len(keyence):] == keyence:
        flag = True
        break

if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
import sys
s = input()
if s == "keyence":
    print("YES")
    sys.exit()
for i in range(len(s)):
    for j in range(i, len(s)):
        if "keyence" == s[:i] + s[j+1:]:
            print("YES")
            sys.exit()

print("NO")

Solution (Python):
K = "keyence"
N = len(K)


def judge(s):
    for i in range(N + 1):
        if s.startswith(K[:i]) and s.endswith(K[i:]):
            return True
    else:
        return False


def main():
    print("YES" if judge(input()) else "NO")


if __name__ == "__main__":
    main()

Solution (Python):

S = input()
flag=False
for i in range(len(S)):
    for j in range(i,len(S)+1):
        if S[:i]+S[j:]=="keyence":
            flag=True
            break
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):





s = input()
a = len(s)
ok=0
for i in range(a):
    for j in range(i,a):
        c = s[:i]+s[j:]

        if c == 'keyence':
            ok = 1
        
if ok:
    print('YES')
else:
    print('NO')

Solution (Python):
s = input()
K = "keyence"

def solve():
    if s.startswith(K) or s.endswith(K):
        return "YES"
    else:
        for i in range(len(K)):
            head = K[:i]
            tail = K[i:]
            if s.startswith(head) and s.endswith(tail):
                return "YES"
    return "NO"

print(solve())

Solution (Python):
S = input()

for i in range(len(S)):
    for j in range(i, len(S)):
        if S[:i] + S[j:] == 'keyence':
            print('YES')
            exit()

print('NO')

Solution (Python):
s = input()
for i in range(len(s)):
    for j in range(i, len(s)):
        a = s[:i] + s[j:]
        if a == "keyence":
            print("YES")
            exit()
print("NO")

Solution (Python):

import re

def solve(s):
    if s == 'keyence':
        return True
    if re.match(r'^([a-z]+)keyence$', s):
        return True
    if re.match(r'^k([a-z]+)eyence$', s):
        return True
    if re.match(r'^ke([a-z]+)yence$', s):
        return True
    if re.match(r'^key([a-z]+)ence$', s):
        return True
    if re.match(r'^keye([a-z]+)nce$', s):
        return True
    if re.match(r'^keyen([a-z]+)ce$', s):
        return True
    if re.match(r'^keyenc([a-z]+)e$', s):
        return True
    if re.match(r'^keyence([a-z]+)$', s):
        return True
    return False

s = raw_input().rstrip()

if solve(s):
    print 'YES'
else:
    print 'NO'

Solution (Python):
s = input()

for i in range(len(s)):
  for j in range(i + 1, len(s)):
    if s == 'keyence' or s[:i] + s[j:] == 'keyence':
      print('YES')
      raise SystemExit

print('NO')

Solution (Python):
S=raw_input()
L=len(S)
r="NO"
for i in xrange(L):
  for j in xrange(i,L):
    if S[:i]+S[j:]=="keyence":
      r="YES"
print r

Solution (Python):
s=input()
for i in range(len(s)):
    for j in range(i,len(s)+1):
        if s[:i]+s[j:]=='keyence':
            print('YES')
            exit()
print('NO')

Solution (Python):
s=input()
n=len(s)
f=False
for i in range(n):
  for j in range(n):
    if(i<=j):
      if(s[:i]+s[j:]=="keyence"):
        f=True
print("YES" if f else "NO")

Solution (Python):
import sys
s = input()
N = len(s)
for i in range(N):
  for j in range(i+1):
    if s[:j]+ s[i:] == "keyence":
      print("YES")
      sys.exit()
else:
  print("NO")

Solution (Python):


secret = 'keyence'
s = input()
n = len(s)
m = len(secret)

if n < m:
    print("NO")
    exit(0)

for i in range(m):
    if s[:i] + s[-(m - i):] == secret:
        print("YES")
        exit(0)

print("NO")

Solution (Python):
while(True):
    try:
        s = input()
        for i in range(len(s)):
            for j in range(i, len(s)):
                if s[:i] + s[j:] == "keyence":
                    print("YES")
                    exit()
        print("NO")
    except EOFError:
        exit()

Solution (Python):
s = raw_input().strip()
for i in range(len(s)):
	for j in range(len(s)):
		s1 = s[0:i]+s[j:]
		if s1 == "keyence":
			print "YES"
			exit()
print "NO"

Solution (Python):
s=input()
ans='NO'
for i in range(len(s)):
    for j in range(i,len(s)+1):
        if s[:i]+s[j:]=='keyence':
            ans='YES'
print(ans)

Solution (Python):
import re
S = input()
cand = [
    r'^k.*eyence$', r'^ke.*yence$', r'^key.*ence$', r'^keye.*nce$',
    r'^keyen.*ce$', r'^keyenc.*e$', r'^keyence.*$'
]
for r in cand:
    if re.match(r, S):
        print('YES')
        exit()
print('NO')

Solution (Python):
s = input()

ans = 'NO'
for i in range(len(s)):
  for j in range(i, len(s)+1):
    t = s[:i] + s[j:]
    if t == 'keyence':
      ans = 'YES'

print(ans)

Solution (Python):
S=input()
T="keyence"
N=len(S)
for i in range(N):
    for j in range(i,N+1):
        U=(S[:i]+S[j:])
        if U==T:
            print("YES")
            exit()
print("NO")

Solution (Python):
s = input()

f = False
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[:i] + s[j:] == 'keyence':
      f = True

if f:
  print('YES')
else:
  print('NO')

Solution (Python):
S = input()
N = len(S)
key = "keyence"
for i in range(N + 1):
    for j in range(i, N + 1):
        if S[:i] + S[j:] == key:
            print("YES")
            quit()
print("NO")

Solution (Python):
from collections import deque
import sys





s = input()
for i in range(len(s)):
    for j in range(len(s)):
        if i > j:
            continue
        if s[:i] + s[j:] == "keyence":
            print("YES")
            exit()
print("NO")

Solution (Python):
S = input()
N = len(S)
for start in range(N):
    for end in range(start, N):
        if S[:start] + S[end:] == "keyence":
            print("YES")
            exit(0)
else:
    print("NO")

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

setrecursionlimit(10**7)

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

k = "keyence"
m = len(k)

S = input()
N = len(S)

if N < m:
  print("NO")
  exit()

a = next(i for i in range(N, -1, -1) if S[:i] == k[:i])
b = next(i for i in range(N, -1, -1) if S[N-i:] == k[m-i:])

print("YES" if a + b >= m else "NO")

Solution (Python):

import sys

input=sys.stdin.readline
mii=lambda:map(int,input().split())

s=input().strip()

yes=0
for i in range(7):
    if s[:i]+s[-7+i:]=="keyence":
        yes=1
    
if s[:7]=="keyence":    
    yes=1

print("YES" if yes else "NO")

Solution (Python):
S = input()
N = len(S)
for i in range(N):
    for j in range(N):
        if i > j: continue
        if S[:i] + S[j:] == 'keyence':
            print('YES')
            exit(0)

print('NO')

Solution (Python):
import sys
S=input()
N=len(S)
for i in range(N):
    for j in range(i,N):
        T=S[0:i]
        L=S[j:N]
        if T+L=='keyence':
            print('YES')
            sys.exit()
print('NO')

Solution (Python):
s = input()
t = "keyence"

c = 0
for i in range(len(t)):
    if s[i] != t[i]:
        c = i
        break
else:
    c = 7
    
for i in range(len(t)):
    if s[-i-1] != t[-i-1]:
        c += i
        break
else:
    c += 7

if c>= 7:
    print("YES")
else:
    print("NO")

Solution (Python):
s = input()
key = "keyence"


l = 0
r = 0
while l < len(s) and l < len(key) and s[l] == key[l]:l += 1

s = s[::-1]
key = key[::-1]
while r < len(s) and r < len(key) and s[r] == key[r]:r += 1

if (l + r) >= len(key):
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()

for i in range(len(S)):
    for j in range(i,len(S)):
        if S[:i] + S[j:] == 'keyence':
            print('YES')
            exit()
print('NO')

Solution (Python):
s = input()
ok = False
for i in range(len(s)+1):
	for j in range(len(s)+1):
		if s[:i]+s[j:] == "keyence":
			ok = True
			break
if ok:
	print("YES")
else:
	print("NO")

Solution (Python):
s = input()
l = len(s)
for i in range(l):
    for j in range(i,l):
        if 'keyence' == (s[:i] + s[j:]):
            print('YES')
            exit()
print('NO')