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):
S=input()

ans='NO'
if S.find('k')==0 and S.rfind('eyence')==len(S)-6:
    ans='YES'
elif S.find('ke')==0 and S.rfind('yence')==len(S)-5:
    ans='YES'
elif S.find('key')==0 and S.rfind('ence')==len(S)-4:
    ans='YES'
elif S.find('keye')==0 and S.rfind('nce')==len(S)-3:
    ans='YES'
elif S.find('keyen')==0 and S.rfind('ce')==len(S)-2:
    ans='YES'
elif S.find('keyenc')==0 and S.rfind('e')==len(S)-1:
    ans='YES'

print(ans)

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

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

Solution (Python):
S = input()
n = len(S) - 7
for i in range(n, len(S)):
  if S[:i - n] + S[i:] == 'keyence':
    print('YES')
    exit()
    
print('NO')

Solution (Python):
S=str(input())
l=len(S)
key='keyence'
if S=='keyence':
  print('YES')
  exit()
else:  
  for i in range(1,l):
    for j in range(l):
      if S[0:j]+S[i+j:l]==key:
        print('YES')
        exit()
print('NO')

Solution (Python):
ans_word = "keyence"

s = input()
flag = False
if s == ans_word:
    flag = True
else:
    for i in range(len(s)-1):
        for j in range(i+1, len(s)):
            if s[:i] + s[j:] == ans_word:
                flag = True
                break
        if flag:
            break

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

Solution (Python):
import sys
S = input()


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

print("NO")

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

Solution (Python):
s=input()
x='keyence'
for i in range(7):
  if s[:i]+s[-7+i:]==x:
    print('YES')
    quit()
print('NO')

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
import bisect
setrecursionlimit(10 ** 7)

s = input()
point = 0

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

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
ans = 'keyence'
S = input()
lenS = len(S)
for i in range(1,7):
    
    
    if ans[:i] == S[:i] and ans[i:] == S[lenS - 7 + i:]:
        print('YES')
        exit()
print('NO')

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

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

Solution (Python):
s = input()
k = "keyence"
for i in range(8):
    if s.startswith(k[:i]) and s.endswith(k[i:]):
        print("YES")
        break
else:
    print("NO")

Solution (Python):
a = "keyence"
S = input().strip()
N = len(S)
flag = 0
for i in range(N):
    if flag==0 and i<len(a) and S[i]==a[i]:continue
    elif flag==0 and i<len(a) and S[i]!=a[i]:
        flag = 1
        cur = i
        break
if flag==0:
    print("YES")
else:
    if S[-(7-cur):]==a[cur:]:
        print("YES")
    else:
        print("NO")

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

Solution (Python):
import sys
import re

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

S = 'keyence'
N = len(S)
T = input()
M = len(T)

for i in range(N+1):
    S1 = S[:i]
    S2 = S[i:]
    exp = '^{0}(.*){1}$'.format(S1, S2)
    if re.match(exp, T):
        YES()
        exit()
NO()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
mod = 10**9 + 7

s = input()

if "keyence" in s:
    print("YES")
    sys.exit()

n = len(s)
m = n - 7

for i in range(n):
    s_ = s[:i] + s[i + m:]
    if s_ == "keyence":
        print("YES")
        sys.exit()

print("NO")

Solution (Python):
s = input()
n = len(s)

ans = 'NO'
for i in range(n):
    for j in range(i-1, n):
        string = s[:i] + s[j+1:]
        if string == 'keyence':
            ans = 'YES'
print(ans)

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

for i in range(len(K) + 1):
    if S.startswith(K[:i]) and S.endswith(K[i:]):
        print("YES")
        break
else:
    print("NO")

Solution (Python):
import sys
input = sys.stdin.readline
from collections import *

S = input()[:-1]

if S=='keyence':
    print('YES')
    exit()

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

print('NO')

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

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

for i in range(len(k) + 1):
    if S[:i] == k[:i] and S[-(len(k) - i):] == k[-(len(k) - i):]:
        print("YES")
        exit()

print("NO")

Solution (Python):
s=input()
str1="keyence"
count=0
num=len(s)
if s==str1:
    yn=0
elif s[:7]==str1:
    yn=0
elif s[num-8:]==str1:
    yn=0
else:
    for i in range(7):
        if str1[i]==s[i]:
            count+=1
        else:
            break
    if s[num-7+count:]==str1[count:]:
        yn=0
    else:
        yn=1
if yn==0:
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()
k = "keyence"
if S.startswith(k) or S.endswith(k):
    print("YES")
    exit()
for i in range(1, len(k)):
    if S.startswith(k[:i]) and S.endswith(k[i:]):
        print("YES")
        break
else:
    print("NO")

Solution (Python):
S=input()
l=len(S)
a=0
for i in range(l):
  for j in range(i,l):
    if S[:i]+S[j:]=="keyence":
      a=1
      break
  if a==1:
    break
print(["NO","YES"][a])

Solution (Python):
S = input()
for i in range(8):
  if S[:i] + S[-7+i:] == 'keyence':
    print('YES')
    quit()

print('NO')

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

Solution (Python):
s = input()
key = "keyence"
l = len(key)
if s[:l] == key or s[-l:] == key:
	print("YES")
	exit()
for i in range(l):
	if s[:i] == key[:i] and s[-(l-i):] == key[-(l-i):]:
		print("YES")
		exit()
else:
	print("NO")

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

Solution (Python):
from itertools import product

S = input()

for i, j in product(range(len(S)), range(len(S))):
    if S[:i] + S[j:] == "keyence":
        print("YES")
        break
else:
    print("NO")

Solution (Python):
S = input()


def f():
    for i in range(len(S)):
        for j in range(len(S)):
            if S[:i] + S[j:] == "keyence":
                print("YES")
                return
    else:
        print("NO")


f()

Solution (Python):
S = input()


def f():
    if S == "keyence":
        print("YES")
    else:
        n = len(S)
        for i in range(n):
            for j in range(i, n):
                T = ""
                for k in range(n):
                    if i <= k <= j:
                        continue
                    else:
                        T += S[k]
                if T == "keyence":
                    print("YES")
                    return
        else:
            print("NO")


f()

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()
a = 'keyence'
n = len(s)
d =0
for i in range(n):
  for j in range(i,n+1):
    if s[:i]+s[j:] == a:
      d += 1
if d == 0:
  print('NO')
else:
  print('YES')

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

Solution (Python):
S = list(input())
L = len(S)
key = list("keyence")

for i in range(0,8):
    if S[0:i] == key[0:i] and S[L-7+i:] == key[i:]:
        print("YES")
        exit()
print("NO")

Solution (Python):
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():

        s=input()
        n=len(s)
        if s=='keyence':
            return 'YES'
        else:
            for i in range(n):
                for j in range(i+1,n+1):
                    if s[:i]+s[j:]=='keyence':
                        return 'YES'
            return 'NO'
    print(main())
resolve()

Solution (Python):

def main():
    S = input()
    N = len(S)
    for i in range(N):
        for j in range(N-i):
            if S[:j] + S[j+i:] == 'keyence':
                print('YES')
                return
    print('NO')


if __name__ == "__main__":
    main()

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

Solution (Python):
s = input()
b = s[:7]
e = s[-7:]
flg = 0
for i in range(7):
  if b[:i] + e[i:] == "keyence":
    flg = 1
if flg:
  print("YES")
else:
  print("NO")

Solution (Python):
S = input()
target = "keyence"
length = len(target)+1






if target in S: 
    print("YES")
    exit()
else: 
    for i in range(1, length):
      first = target[:i]
      second = target[i:]
      
      if first in S and second in S and S.find(first) < S.rfind(second):
          if S[0:len(first)] + S[len(S)-len(second):len(S)] == target:
                print("YES")
                exit()
print("NO")

Solution (Python):
import sys
s = input()
O = "keyence"
k = 0
for i in range(7,0,-1):
    if s[:i] == O[:i]:
        k = i
        if k == 7:
            print("YES")
            sys.exit()
        break
if s[len(s)+k-7:len(s)] == O[k:]:
    print("YES")
else:
    print("NO")

Solution (Python):
s = input()
tgt = 'keyence'
ans = 'NO'
for i in range(8):
    if s[:i] == tgt[:i] and s[len(s)-(7-i):] == tgt[i:]:
        ans = 'YES'
        break
print(ans)

Solution (Python):
import sys, re

S = sys.stdin.readline().rstrip()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')

Solution (Python):
import re

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')

Solution (Python):
from pprint import pprint

s = str(input())


keyence_list = [[0,0] for _ in range(6)]











i = 0
if s[i] == "k":
    if s[i+1] == "e":
        if s[i+2] == "y":
            if s[i+3] == "e":
                if s[i+4] == "n":
                    if s[i+5] == "c":
                        if s[i+6] == "e":
                            print("YES")
                            exit()
                        else:
                            keyence_list[0][0] = 1
                    else:
                        keyence_list[1][0] = 1
                else:
                    keyence_list[2][0] = 1
            else:
                keyence_list[3][0] = 1
        else:
            keyence_list[4][0] = 1
    else:
        keyence_list[5][0] = 1
else:
    pass


j = len(s)-1
if s[j] == "e":
    if s[j-1] == "c":
        if s[j-2] == "n":
            if s[j-3] == "e":
                if s[j-4] == "y":
                    if s[j-5] == "e":
                        if s[j-6] == "k":
                            print("YES")
                            exit()
                        else:
                            keyence_list[5][1] = 1
                    else:
                        keyence_list[4][1] = 1
                else:
                    keyence_list[3][1] = 1
            else:
                keyence_list[2][1] = 1
        else:
            keyence_list[1][1] = 1
    else:
        keyence_list[0][1] = 1
else:
    pass

for k in range(6):
    for l in range(k,6):
        if keyence_list[k][0] == keyence_list[l][1] == 1:
            print("YES")
            exit()

print("NO")
exit()

Solution (Python):
s=input()
k='keyence'
ans='NO'
for i in range(8):
  if s[:i]==k[:i] and s[len(s)-(7-i):]==k[i:]:
    ans='YES'
print(ans)

Solution (Python):
def main():
    S  = input()
    K = 'keyence'
    if len(S)<=7:
        if S == K:
            print('YES')
        else:
            print('NO')
    else :
        ShaveN = len(S) - 7
        for i in range(len(S) - ShaveN + 1):
            Shave = S[:i] + S[i+ShaveN:]
            if Shave == K:
                print('YES')
                return
        print('NO')


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
key = "keyence"
j = 0
while j < len(key) and s[j] == key[j]:
    j += 1

j -= 1
for i in range(len(key) - j - 1):
    if s[len(s) - 1 - i] != key[len(key) - 1 - i]:
        print("NO")
        exit()
print("YES")

Solution (Python):
import re
s = input()
a = []
a += [re.match(r'.*keyence$', s)]
a += [re.match(r'k.*eyence$', s)]
a += [re.match(r'ke.*yence$', s)]
a += [re.match(r'key.*ence$', s)]
a += [re.match(r'keye.*nce$', s)]
a += [re.match(r'keyen.*ce$', s)]
a += [re.match(r'keyenc.*e$', s)]
a += [re.match(r'keyence.*$', s)]
print('YES' if any(a) else 'NO')

Solution (Python):
S = input()

if S[0] != "k":
    if S[-7:] == "keyence":
        print("YES")
    else:
        print("NO")

elif S[-1] != "e":
    if S[:7] == "keyence":
        print("YES")
    else:
        print("NO")

else:
    if S[:1] == "k" and S[-6:] == "eyence":
        print("YES")
    elif S[:2] == "ke" and S[-5:] == "yence":
        print("YES")
    elif S[:3] == "key" and S[-4:] == "ence":
        print("YES")
    elif S[:4] == "keye" and S[-3:] == "nce":
        print("YES")
    elif S[:5] == "keyen" and S[-2:] == "ce":
        print("YES")
    elif S[:6] == "keyenc" and S[-1:] == "e":
        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 = list(input())
tf = [False for _ in range(7)]
key = list("keyence")
for n in range(7):
    if S[n] == key[n]:
        tf[n] = True
    else:
        break
for n in range(1, 8):
    if S[-n] == key[-n]:
        tf[-n] = True
    else:
        break
if all(tf):
    print("YES")
else:
    print("NO")

Solution (Python):
s = input()
n = len(s)

if "keyence" == s:
    print("YES")
    exit()

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

print("NO")

Solution (Python):
s = input()
k = 'keyence'
k_size = len(k)
d_size = len(s) - k_size

result = "NO"
for i in range(k_size):
    t = s[:i] + s[i+d_size:]
    if t == k:
        result = "YES"
        break
print(result)

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

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

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

Solution (Python):
import re,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
str = 'keyence'
pattern_keyence = []
for i in range(len(str)+1):
    pattern_keyence.append(r'{}'.format(str[:i]+'.*'+str[i:]))
for p in pattern_keyence:
    if re.fullmatch(p,S):
        print('YES')
        break
else:
    print('NO')

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

Solution (Python):
import re,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
str = 'keyence'
pattern_keyence = []
for i in range(len(str)+1):
    pattern_keyence.append(str[:i]+'.*'+str[i:])
for x in pattern_keyence:
    if re.fullmatch(x,S):
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
count = 0
for i,j in itertools.combinations_with_replacement(range(len(S)+1),2):
    if S[:i]+S[j:]=='keyence':
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
for i,j in itertools.combinations(range(len(S)+2),2):
    if S[:i]+S[j-1:]=='keyence':
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import re,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
p1 = r'.*keyence'
p2 = r'k.*eyence'
p3 = r'ke.*yence'
p4 = r'key.*ence'
p5 = r'keye.*nce'
p6 = r'keyen.*ce'
p7 = r'keyenc.*e'
p8 = r'keyence.*'
if re.fullmatch(p1,S) or re.fullmatch(p2,S) or re.fullmatch(p3,S) or re.fullmatch(p4,S) or re.fullmatch(p5,S) or re.fullmatch(p6,S) or re.fullmatch(p7,S) or re.fullmatch(p8,S):
    print('YES')
else:
    print('NO')

Solution (Python):
import sys

S = input()
target = "keyence"
del_len = len(S) - len(target)

for i in range(len(S) - del_len+1):
    s = S[:i] + S[i + del_len:]
    if s==target:
        print("YES")
        sys.exit()
print("NO")

Solution (Python):
S = input()
ans = "NO"
for i in range(len(S)):
  for j in range(len(S)):
    if S[0:i] + S[i+j:len(S)] == "keyence":
      print("YES")
      exit()
print(ans)

Solution (Python):






S = input()





keyence = "keyence"
length = len(keyence)
flag = True
for i in range(len(keyence)):

    if S[:i+1] == keyence[:i+1]:
        if S[-length+i+1:] == keyence[-length+i+1:]:
            print("YES")
            flag = False
            break
if flag:
    print("NO")

Solution (Python):
k = list('keyence')
s = list(input())
while len(k) > 0:
    if k[0] == s[0]:
        k.pop(0)
        s.pop(0)
    else:
        break
while len(k) > 0:
    if k[-1] == s[-1]:
        k.pop()
        s.pop()
    else:
        break
if len(k) == 0:
    print('YES')
else:
    print('NO')

Solution (Python):
A=input()
if A=="keyence" or A[:7]=="keyence" or A[-7:]=="keyence":
   print("YES")
   exit()
for i in range(6):
   if A[:i+1]+A[-6+i:]=="keyence":
      print("YES")
      exit()
print("NO")

Solution (Python):
S = input()

key = list("keyence")
target = 'keyence'

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == target and not flg:
            print("YES")
            flg = True
            break

if not flg:
    print("NO")

Solution (Python):


S = input()
key = 'keyence'
K = []

if key in S:
    print('YES')
    exit()


for i in range(len(key)+1):
    K.append([key[:i],key[i:]])

for i in range(len(K)):
    if S[:len(K[i][0])] == K[i][0] and S[len(S)-len(K[i][1]):] == K[i][1]:
        print('YES')
        exit()
print('NO')

Solution (Python):

import collections
import itertools as it
import math

 
s  = input()







query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern1 = r'{}{}'.format(b, a)
    pattern2 = r'^{}.*{}$'.format(b, a)
    
    
    if re.findall(pattern1, s) or re.findall(pattern2, s):
        print('YES')
        break
else:
    print('NO')

Solution (Python):


S = input()
key = 'keyence'
K = []

if key in S:
    print('YES')
    exit()


for i in range(len(key)+1):
    K.append([key[:i],key[i:]])

for i in range(len(K)):
    if K[i][0] in S and K[i][1] in S:
        if S[0] == 'k' and S[-1] == 'e':
            print('YES')
            exit()
print('NO')

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]

def to_bin(x: int) -> str: return format(x, 'b') 
def to_oct(x: int) -> str: return format(x, 'o') 
def to_hex(x: int) -> str: return format(x, 'x') 
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i): is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res

from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

def main():
    s = IS()
    n = len(s)
    m = n-7
    for i in range(0,n-m):
        if s[:i]+s[i+m:] == 'keyence':
            print('YES')
            return None
    print('NO')

if __name__ == '__main__':
    main()

Solution (Python):
T = input()
for f in range(8):
    b = 7-f
    if b and (T[:f] + T[-b:] == "keyence"):
        print("YES")
        exit()
    elif T[-7:] == "keyence":
        print("YES")
        exit()
print("NO")

Solution (Python):

s = input()

target = 'keyence'
flg = False
for i in range(len(s)):
    for j in range(len(s)):
        tmp = s[0:i] + s[j:]
        if tmp == target and not flg:
            print('YES')
            flg = True
            break
if not flg:
    print('NO')

Solution (Python):
s = "0"+input()+'0'
l = len(s)-2
for i in range(1,l+1):
  for j in range(i,l+1):
    a = s[:i]+s[j:]
    if a=="0keyence0":
      print("YES")
      exit()
print("NO")

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

Solution (Python):
def main():
    S = list(input())
    tmp = list('keyence')
    st = -1; ed = -1
    if S[0] == tmp[0]:
        st = 0
        for i in range(1, len(tmp)):
            if S[i] == tmp[i]:
                st += 1
            else:
                break
    if st+1 == len(tmp):
        print('YES')
        return
    if S[-1] == tmp[-1]:
        ed = 0
        for i in range(1, len(tmp)):
            if S[-1-i] == tmp[-1-i]:
                ed += 1
            else:
                break
    if ed+1 == len(tmp):
        print('YES')
        return
    if st == -1 or ed == -1:
        print('NO')
        return
    rm = (st+1 + ed+1) - len(tmp)
    if rm >= 0:
        s = tmp[:st+1] + tmp[-ed-1+rm:]
        if s == tmp:
            print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()

Solution (Python):
S = input()

import sys

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

Solution (Python):
import itertools

S = list(input())
KEY = list('keyence')
LK = len(KEY)
L = len(S)
ok = False
for s,t in itertools.combinations(range(L),2):
  idx = 0
  sub_S = S[0:s] + S[t:]
  if sub_S == KEY:
    ok = True
    
if ok or S == KEY:
  print('YES')
else:
  print('NO')

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

str_keyence = "keyence"

if S.find("keyence")==0 or S.rfind("keyence")==len(S)-7:
  print("YES")
else:
  for i in range(1,7):
      
      
      
      if S.find(str_keyence[0:i])==0 and S.rfind(str_keyence[i:])==len(S)-len(str_keyence[i:]):
          print("YES")
          break
  else:
      print("NO")

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

if(S == 'keyence'):
    print('YES')
    exit()

for i in range(L):
    count = 0
    for j in range(i, L):
        if (i == 0 and count == 0):
            s = S[1:]
        elif(i == L - 1):
            s = S[:i]
        else:
            s = S[:i] + S[i + count + 1:]

        if (s == 'keyence'):
            print('YES')
            exit()
        else:
            count += 1

print('NO')

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if x == len(match):
        break
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    remainFlag = False
    remain = match[x:]
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(remain))
    for y in range(len(revS)):
        
        if y == len(revMatch):
            remainFlag = True
            break
        if revMatch[y] == revS[y]:
            revcheck += revS[y]
        else:
            break
    if remainFlag:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()
ans = "NO"
for i in range(len(S)):
  for j in range(len(S)):
    if S[0:i] + S[i+j:len(S)] == "keyence":
      print("YES")
      exit()
print(ans)

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

Solution (Python):
import re
s = input()
t = 'keyence'

for i in range(len(t)+1):
    if s.startswith(t[:i+1]) and s.endswith(t[i+1:]):
        print('YES');exit()
print('NO')

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

print('NO')

Solution (Python):
s=input()
k="keyence"
if s.find(k,0,7)!=-1 or s.find(k,len(s)-7)!=-1:
    print("YES")  
    exit()
for i in range(1,7):
    a=s.find(k[:i],0,len(k[:i]))
    if a==0:
        b=s.find(k[i:],len(s)-len(k[i:]))
        if b!=-1:
            print("YES")
            exit()
print("NO")

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

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

Solution (Python):
S = input()

for i in range(7):
	if S[:i] + S[i-7:] == "keyence":
		print("YES")
		exit()
print("NO")

Solution (Python):
s = input()
n = len(s)

target = 'keyence'

for i in range(n):
	for j in range(i, n):
		res = s[:i] + s[j:]
		if res == target:
			print('YES')
			exit()

print('NO')

Solution (Python):
A=list("keyence")
f=-1;p=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i]:
        p=p+1
      else:
        if A[0:p]+S[len(S)-(len(A)-p):len(S)]==A:
          f=1
          break
        else:
          f=0
          break
print("YES" if f==1 else "NO")