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()
s=list(s)
a=list('keyence')
for i in range(8):
    if s[:i]==a[:i] and s[i-7:]==a[i-7:]:
        print('YES')
        quit()
print('NO')

Solution (Python):


import sys

S = input()

keyence = 'keyence'

for i in range(8):
    
    if S[:i] == keyence[:i] and S[len(S)+i-7:] == keyence[i-7:]:
        print('YES')
        sys.exit()
        
print('NO')

Solution (Python):
S = input()
c = 0
for i, s in enumerate("keyence"):
    if s == S[i]:
        c += 1
    else:
        break
S = S[::-1]
for i, s in enumerate("keyence"[::-1]):
    if s == S[i]:
        c += 1
    else:
        break

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

Solution (Python):


def main():
    S = input()
    target = "keyence"

    if len(S) >= 7 and S[0:7] == "keyence":
        return "YES"

    for i in range(len(S)):
        if S[i] != target[i]:
            itti_len = i
            break

    latter = target[itti_len:7]

    if S[len(S)-(7-itti_len):len(S)] == latter:
        return "YES"
    else:
        return "NO"


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

Solution (Python):




s = input()

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

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



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

Solution (Python):

S=str(input())


K='keyence'

ans=0

'''
print('first=',S[0:6])
print('last=',S[len(S)-7:])
if S[0:7]==K:
    ans=1
if S[len(S)-7:]==K:
    ans=1
'''

for i in range(7+1):

    if S[0:i]+S[len(S)-7+i:]==K:
        ans=1

        
if ans==1:    
    print('YES')
else:
    print('NO')

Solution (Python):
import sys

s = input()

f = True
ac = 'keyence'
i = 0
j = 0

while i < len(s):
    if j == len(ac):
        break
    if s[i] == ac[j] and f:
        i += 1
        j += 1
    elif f:
        k = 1
        l = 1
        while abs(l) < len(ac) - j + 1:
            if s[len(s) - k] == ac[len(ac) - l]:
                k += 1
                l += 1
            else:
                print('NO')
                sys.exit()
        break
    else:
        print('NO')
        sys.exit()

print('YES')

Solution (Python):
x = input()
l = len(x)
flag = 0
for i in range(l):
    for j in range(l):
        res = x[0:i] + x[j:l]
        if(res == 'keyence'):
            flag = 1
if(flag == 1):
    print('YES')
else:
    print('NO')

Solution (Python):
import sys
s = input()
l =[['k','eyence'],['ke','yence'],['key','ence'],['keye','nce'],['keyen','ce'],['keyenc','e']]

if s.startswith('keyence') or s.endswith('keyence'):
    print('YES')
else:
    for i in l:
        tmps = s
        if s.startswith(i[0]) and s.endswith(i[1]):
            print('YES')
            sys.exit(0)
    else:
        print('NO')

Solution (Python):
def main():
    S = input()
    if S[0] != 'k':
        if S[-7:] == 'keyence':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[1] != 'e':
        if S[-6:] == 'eyence':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[2] != 'y':
        if S[-5:] == 'yence':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[3] != 'e':
        if S[-4:] == 'ence':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[4] != 'n':
        if S[-3:] == 'nce':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[5] != 'c':
        if S[-2:] == 'ce':
            print('YES')
            return
        else:
            print('NO')
            return
    if S[6] != 'e':
        if S[-1:] == 'e':
            print('YES')
            return
        else:
            print('NO')
            return
    print('YES')


if __name__ == "__main__":
    main()

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

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

Solution (Python):
s=input()
l=['k','e','y','e','n','c','e']
flag=False
cnt=0
for i in range(7):
    if flag==False and s[i]==l[i]:
        cnt+=1
    else:
        flag=True
        if s[-(7-i)]==l[i]:
            cnt+=1
if cnt==7:
    print('YES')
else:
    print('NO')

Solution (Python):

S = input()
WORD = "keyence"

if S == WORD:
    print("YES")
    exit()

for s in range(len(S)):
    for e in range(s,len(S)+1):
        a = S[:s]
        sub = S[s:e]
        b = S[e:]
        
        
        
        if a+b == WORD:
            print("YES")
            exit()

print("NO")

Solution (Python):
s=input()
a=len(s)
if s[0]=='k' and s[1]=='e' and s[2]=='y' and s[3]=='e' and s[4]=='n' and s[5]=='c' and s[6]=='e':
    print('YES')
elif s[0]=='k' and s[1]=='e' and s[2]=='y' and  s[3]=='e' and s[4]=='n' and s[5]=='c' and s[a-1]=='e':
    print('YES')
elif s[0]=='k' and s[1]=='e' and s[2]=='y' and s[3]=='e' and s[4]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
elif s[0]=='k' and s[1]=='e' and s[2]=='y' and s[3]=='e' and s[a-3]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
elif s[0]=='k' and s[1]=='e' and s[2]=='y' and s[a-4]=='e' and s[a-3]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
elif s[0]=='k' and s[1]=='e' and s[a-5]=='y' and s[a-4]=='e' and s[a-3]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
elif s[0]=='k' and s[a-6]=='e' and s[a-5]=='y' and s[a-4]=='e' and s[a-3]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
elif s[a-7]=='k' and s[a-6]=='e' and s[a-5]=='y' and s[a-4]=='e' and s[a-3]=='n' and s[a-2]=='c' and s[a-1]=='e':
    print('YES')
else:
    print('NO')

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

Solution (Python):
def inpl(): return list(map(int, input().split()))
S = input()
x = "keyence"
OK = False
if S[:7] == x or S[-7:] == x:
    print("YES")
else:
    for i in range(1, 8):
        if S[:i] == x[:i] and S[-7+i:] == x[i:]:
            print("YES")
            break
    else:
        print("NO")

Solution (Python):
S = input()

A = ["","k","ke","key","keye","keyen","keyenc","keyence"]
B = ["keyence","eyence","yence","ence","nce","ce","e",""]
ans = "NO"
for i in range(len(A)) :
    if S[:len(A[i])] + S[-len(B[i]):] == "keyence" :
        ans = "YES"

print(ans)

Solution (Python):
S = input()
keyence = "keyence"
if S.split()[0] == keyence:
    print("YES")
for idx, (s, k)  in enumerate(zip(S, keyence)):
    if s==k:
        continue
    else:
        nokori = keyence[idx:]
        if S[-len(nokori):] == nokori:
            print("YES")
            break
        else:
            print("NO")
            break

Solution (Python):
S = input()
w = 'keyence'
n = len(w)
N = len(S)
ch = 0
if 'keyence' in S and len(S) == len('keyence'):
    ch = 1

elif S[:3] == 'key' and S[-4:] == 'ence':
    ch = 1

elif S[:1] == 'k' and S[-6:] == 'eyence':
    ch = 1

elif S[:2] == 'ke' and S[-5:] == 'yence':
    ch = 1
elif S[:4] == 'keye' and S[-3:] == 'nce':
    ch = 1
elif S[:5] == 'keyen' and S[-2:] == 'ce':
    ch = 1
elif S[:6] == 'keyenc' and S[-1:] == 'e':
    ch = 1

if ch == 1:
    print('YES')
else:
    print('NO')

Solution (Python):
s=input()
f = 0
if s[:7] == 'keyence':
    f = 1
elif s[-7:] == 'keyence':
    f = 1
else:
    for i in range(7):
        if s[:i]+s[-7+i:] == 'keyence':
            f = 1
            break
if f == 1:
    print('YES')
else:
    print('NO')

Solution (Python):
s = input()

ans="NO"
if s[0:7]=="keyence":
  ans="YES"
elif s[-8:-1]=="keyence":
  ans="YES"
elif s[0:1]=="k" and s[-6:]=="eyence":
  ans="YES"
elif s[0:2]=="ke" and s[-5:]=="yence":
  ans="YES"
elif s[0:3]=="key" and s[-4:]=="ence":
  ans="YES"
elif s[0:4]=="keye" and s[-3:]=="nce":
  ans="YES"
elif s[0:5]=="keyen" and s[-2:]=="ce":
  ans="YES"
elif s[0:6]=="keyenc" and s[-1:]=="e":
  ans="YES"

print(ans)

Solution (Python):
S = input()

ans = False

if S[:7] == "keyence":
    ans = True

if S.find("k") != -1:
    if S.find("keyenc")== 0and S[-1] == "e":
            ans = True
    if S.find("keyen")== 0 and S[-2:] == "ce":
        ans = True
    if S.find("keye")== 0 and S[-3:] == "nce":
        ans = True
    if S.find("key")== 0and S[-4:] == "ence":
        ans = True
    if S.find("ke")== 0 and S[-5:] == "yence":
        ans = True
    if S.find("k")== 0 and S[-6:] == "eyence":
        ans = True

else:
    if S[-7:] == "keyence":
        ans = True

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

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
import re
sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    K = 'keyence'
    if S == K:
        return 'YES'
    if re.fullmatch('[a-z]+'+K, S):
        return 'YES'
    if re.fullmatch(K+'[a-z]+', S):
        return 'YES'

    for i in range(len(K)):
        if re.fullmatch(K[:i]+'[a-z]+'+K[i:], S):
            return 'YES'

    return 'NO'


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Solution (Python):
str = input()
n = len(str)
flag = "NO"
for i in range(8):
	buf = str[:i]+str[n-7+i:]
	if(buf == "keyence"):
		flag = "YES"
	
print(flag)

Solution (Python):
S = input()


x = "keyence"

if S[:7] == x:
    print("YES")
    exit()

for i in range(0,len(x)):
    if S[:i]== x[:i] and S[-(7-i):] == x[i:] :
        print("YES")
        exit()
    
    
    
    
    
    
    
    
    
    
print("NO")

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

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

Solution (Python):
S = input()
s = [i for i in S]
ans = ["k","e","y","e","n","c","e"]
f = 0
for i in range(7):
    if s[:i]+s[-(7-i):] == ans:
        f = 1
        break
if f == 0:
    print("NO")
else:
    print("YES")

Solution (Python):
s = input()
N = len(s)
k = "keyence"
K = len(k)
flag = False
if s[N - K:] == k:
    print("YES")
    exit()
if s[:K] == k:
    print("YES")
    exit()

for i in range(1, K):
    if s[:i] == k[:i] and s[N - (K - i):] == k[K - (K - i):]:
        print("YES")
        exit()

print("NO")

Solution (Python):
s = input()
true = 'keyence'

from itertools import product
ans = 'NO'
for start, end in product(range(len(s)), range(len(s))):
    if start > end:
        continue
    else:
        temp = s[:start] + s[end:]
        if true == temp:
            ans = 'YES'
            break
print(ans)

Solution (Python):
s = list(input())
l = list("keyence")
ans = "NO"
for i in range(len(s)):
    for j in range(len(s)-i):
        
        part = s[:i] + s[i+j:]
        if part == l:
            ans = "YES"
            break
print(ans)

Solution (Python):

s = input()
yojou = len(s) - 7

for i in range(yojou + 2):
    
    if s[0:i] + s[i + yojou:] == 'keyence':
        print("YES")
        exit(0)
print("NO")

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

Solution (Python):
s=input()
if s=="keyence":
	print("YES")
	quit()
for i in range(len(s)):
	for p in range(i,len(s)):
		if i==0 and p==len(s)-1:
			continue
		if i==0:	
			t=s[p+1]
			if t=="keyence":
				print("YES")
				quit()
		if p==len(s)-1:
			t=s[:i]
			if t=="keyence":
				print("YES")
				quit()
		t=s[:i]+s[p+1:]
		if t=="keyence":
				print("YES")
				quit()
print("NO")

Solution (Python):
S = input()
N = len(S)
if S == "keyence" or S[1:] == "keyence" or S[:N-1] == "keyence":
    print("YES")
    exit(0)

for k in range(N):
    for l in range(k,N):
        if S[:k]+S[l+1:] == "keyence":
            print("YES")
            exit(0)
print("NO")

Solution (Python):
A=input()
char=len(A)-7
flag=0

if A[:7]=="keyence":
    flag=1

for i in range(len(A)-char):
    if A[:i]+A[i+char:]=="keyence":
        flag=1
    
if flag==1:
    print("YES")
else:
    print("NO")

Solution (Python):
a = input()
minus = len(a)-7
check = 0
for i in range(len(a)-minus+1):
  tmp = a[0:i] + a[i+minus:]
  if tmp == 'keyence':
    check = 1
    break
if check == 1:
  print("YES")
else:
  print("NO")

Solution (Python):
S = input()
res = 'NO'
for s in range(len(S)):
    for t in range(len(S)):
        
        if S[:s] + S[t+1:] == 'keyence':
            res = 'YES'
print(res)

Solution (Python):


import re

def solve():
    S = input()
    k = 'keyence'
    res = any(re.fullmatch(k[:i]+'.*'+k[i:], S) for i in range(len(k)+1))
    if res:
        res = 'YES'
    else:
        res = 'NO'
    return str(res)

if __name__ == '__main__':
    print(solve())

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

if re.search(r'^k.*eyence$', S) or \
   re.search(r'^ke.*yence$', S) or \
  re.search(r'^key.*ence$', S) or \
  re.search(r'^keye.*nce$', S) or \
  re.search(r'^keyen.*ce$', S) or \
  re.search(r'^keyenc.*e$', S) or \
  re.search(r'^.*keyence$', S) or \
  re.search(r'^keyence.*', S) or \
  S == 'keyence':
    print('YES')
else:
  print('NO')

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()
lens = len(s)
ans = False
keyence = "keyence"


for i in range(0,8):
    if s[:i] == keyence[:i] and s[i+lens-7:] == keyence[i:]:
        ans = True
            
print("YES") if ans else print("NO")

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

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

Solution (Python):
s = input()
r = "keyence"
flag = False
for i in range(len(r)):
    if r[0:i] == s[0:i] and s[-1 * (7-i):] == r[-1 * (7-i):]:
        flag = True

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

Solution (Python):
S = input()





ans = 'YES'
keyence = 'keyence'

for i in range(len(S)):
    if i == 7:
        S = S[0:7]
        break
    if keyence[i] == S[i]:
        continue
    else:
        S = S[0:i] + S[len(S) - 1 - 6 + i :]
        break


if S == keyence:
    print('YES')
else:
    print('NO')

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

S_rev = S[::-1]

key_front = [False] * 7

key_back = [False] * 7

s_key = ["k", "e", "y", "e", "n", "c", "e"]
s_key_rev = s_key[::-1]

i = 0
while S[i] == s_key[i] and i < 6:
    key_front[i] = True
    i += 1

i = 0
while S_rev[i] == s_key_rev[i] and i < 6:
    key_back[i] = True
    i += 1
ans = 0
for b in key_front:
    if b:
        ans += 1
for b in key_back:
    if b:
        ans += 1

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

Solution (Python):
s = list(input())
t = "keyence"
a = i = 0

while True:
    if len(s) == i:
        break
    
    if s[i] == t[i]:
        a += 1
    else:
        break
    i += 1

i = len(s) - 1
o = len(t) - 1

while True:
    if a == len(t):
        break
    
    if s[i] == t[o]:
        a += 1
    else:
        break
    i -= 1
    o -= 1

if a == len(t):
    print("YES")
else:
    print("NO")

Solution (Python):
s = [i  for i in input()]
left = ["k", "e", "y", "e", "n", "c", "e"]
right = ["e", "c", "n", "e", "y", "e", "k"]
num = 0
for i in range(7):
    if(s[i] == left[i]):
        num += 1
s = list(reversed(s))
for i in range(7):
    if(s[i] == right[i]):
        num += 1
if(num>=7):
    print("YES")
else:
    print("NO")

Solution (Python):
k = 'keyence'
a = input()
b = a.split(k)
if k in a:
    if all(b):
        print('NO')
    else:
        print('YES')
else:
    for i in range(1,7):
        if k[:i] == a[:i] and k[i-7:] == a[i-7:]:
            print('YES')
            break
    else:
        print('NO')

Solution (Python):
S = input()
flag = 0
if S == "keyence":
    flag = 1
for i in range(len(S)-3):
    if str(S[:i]) + str(S[(-1)*(7-i):]) == "keyence":
        flag = 1
if flag == 1:
    print("YES")
else:
    print("NO")

Solution (Python):
k="keyence"
S=input()
check=0
for i in range(7):
  if k[i]!=S[i]:
    for j in range(-1,-8+i,-1):
      if k[j]!=S[j]:
        check=1
        break
    break
if check==0:
  print("YES")
else:
  print("NO")

Solution (Python):

S = input()
target = 'keyence'

for i in range(1, len(S)):
    tarl = target[:i]
    tarr = target[i:]
    if S.startswith(tarl) and S.endswith(tarr):
        print('YES')
        break
    else: continue
else:
    print('NO')

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

Solution (Python):
import re
s = input()

r1 = '^.*keyence$'
r2 = '^k.*eyence$'
r3 = '^ke.*yence$'
r4 = '^key.*ence$'
r5 = '^keye.*nce$'
r6 = '^keyen.*ce$'
r7 = '^keyenc.*e$'
r8 = '^keyence.*$'

if re.match(r1, s) or re.match(r2, s) or re.match(r3, s) or re.match(r4, s) or re.match(r5, s) or re.match(r6, s) or re.match(r7, s) or re.match(r8, s):
    print("YES")
else :
    print("NO")

Solution (Python):
s = input()

keyence = 'keyence'

for index, char in enumerate(s):
    if char!=keyence[0]:
        break
    keyence = keyence[1:]

keyence = keyence[::-1]
for index, char in enumerate(s[::-1]):
    if keyence and char!=keyence[0]:
        break
    keyence = keyence[1:]
    
if not keyence:
    print('YES')
else:
    print('NO')

Solution (Python):
import re

s = input()
t = 'keyence'

for i in range(len(t)):
    ptn = '^' + t[:i] + '.*' + t[i:] + '$'
    
    m = re.match(ptn, s)
    if m: break

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

Solution (Python):
s = input()

if s.startswith('k') and s.endswith('eyence'):
  print('YES')
elif s.startswith('ke') and s.endswith('yence'):
  print('YES')
elif s.startswith('key') and s.endswith('ence'):
  print('YES')
elif s.startswith('keye') and s.endswith('nce'):
  print('YES')
elif s.startswith('keyen') and s.endswith('ce'):
  print('YES')
elif s.startswith('keyenc') and s.endswith('e'):
  print('YES')
else:
  print('NO')

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


if __name__ == '__main__':
  main()

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

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]



s = input()
key = "keyence"
ind = 0

if s[:7] == key or s[7:] == key:
    print("YES")
else:
    ind = 0
    while ind < 7:
        if s[ind] == key[ind]:
            ind += 1
        else:
            break

    flag = True
    for i in range(7 - ind):
        if s[-i-1] != key[-i-1]:
            flag = False
            break
    if flag:
        print("YES")
    else:
        print("NO")

Solution (Python):
S = input()

sample = 'keyence'
flag = True

for i in range(7):
    if S[i] != sample[i]:
        if S[-(7-i):] == sample[-(7-i):]:
            print('YES')

        else:
            print('NO')
        
        flag = False
        break

if flag:
    print('YES')

Solution (Python):
import sys

s=input()

target="keyence"
j=0
mismatch=0

for i in range(len(target)):
    if target[:i]==s[:i] and target[i:]==s[-7+i:]:
        print('YES')
        sys.exit()
print('NO')

Solution (Python):
import math
import copy

def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l

string=input()
removeSize=len(string)-7
target="keyence"
pairs=list()
for idx in range(0,7):
    pair=[target[:idx],target[idx:]]
    pairs.append(pair)
result="NO"
for pair in pairs:

    if string[:len(pair[0])]==pair[0] and string[-len(pair[1]):]==pair[1]:
        result="YES"
print(result)

Solution (Python):
import re

patterns = [
  r'^.*keyence$',
  r'^k.*eyence$',
  r'^ke.*yence$',
  r'^key.*ence$',
  r'^keye.*nce$',
  r'^keyen.*ce$',
  r'^keyenc.*e$',
  r'^keyence.*$',
]

def solve(S):
  for pattern in patterns:
    if re.match(pattern, S):
      return 'YES'
  return 'NO'

S = input()

print(solve(S))

Solution (Python):
sK = "keyence"

sS = input().rstrip()
if sS == sK or sS.startswith(sK) or sS.endswith(sK):
    print("YES")
else:
    for i in range(1,len(sK)):
        if sS.startswith(sK[:i]) and sS.endswith(sK[i:]):
            print("YES")
            exit()
    print("NO")

Solution (Python):
def main(s):
    for x in range(len(s)):
        for y in range(x, len(s)):
            if s[0:x] + s[y:] == 'keyence':
                return 'YES'
    return 'NO'

print(main(input()))

Solution (Python):
S = input()

keyword = "keyence"

if S[0] != 'k':
    if S[-7:] == keyword:
        print("YES")
    else:
        print("NO")
elif S[-1] != 'e':
    if S[:7] == keyword:
        print("YES")
    else:
        print("NO")
else:
    for i in range(1, len(keyword)):
        if S[:i] == keyword[:i] \
            and S[-7+i:] == keyword[-7+i:]:
            print("YES")
            exit(0)
    print("NO")

Solution (Python):



import sys  
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools



sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
def dump(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)


def local_input():
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)


def solve():
    s = input()
    n = len(s)

    key = 'keyence'
    if n == 7:
        if s == key:
            print("YES")
            return 0
        else:
            print("NO")
            return 0

    for i in range(n):
        pre = s[:i]
        suf = s[i+(n-7):]
        dump(pre)
        dump(suf)
        if (pre+suf == key):
            print("YES")
            return 0

    print("NO")
    return 0

if __name__ == "__main__":
    try:
        local_input()
    except:
        pass
    solve()

Solution (Python):
s = input()
 
n = len(s)
nozoku = n - 7

ans = 'NO'

if nozoku == 0:
    if s == 'keyence':
        ans = 'YES'
else:
    
    for i in range(8):
        if s[:i] + s[i+nozoku:] == 'keyence':
            ans = 'YES'
            break
   
    
print(ans)

Solution (Python):
s = str(input())
n = len(s)
if s == "keyence":
 print("YES")
 exit()
else:
 for I in range(8):
  t = s[0:I]+s[I+n-7:n]
  if t == "keyence":
   print("YES")
   exit()
print("NO")

Solution (Python):
def main():
    """
    問題が 3問出題され、
    1問目の配点は A点以下、
    2問目の配点は A+1点以上 B点以下、
    3問目の配点は  B+1点以上である。
    """
    S = input()
    ans = f(S)
    if ans:
        print("YES")
    else:
        print("NO")


def f(S):
    n = len(S)
    ok = False
    target = "keyence"
    for i in range(n):
        for j in range(i, n):
            
            if S[:i] == target:
                return True
            elif S[:i] + S[j:] == target:
                return True
            elif S[j:] == target:
                return True

    return False


if __name__ == '__main__':
    main()

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
s="keyence"
ss=input()
a=7
b=7
for i in range(7):
 if ss[i]!=s[i]:
    a=i
    break
for i in range(7):
 if ss[-(i+1)]!=s[-(i+1)]:
    b=i
    break

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

Solution (Python):

import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] = [(input_raw[0])]
    if S == "keyence":
        print "YES"
        return
    for i in range(len(S)):
        for j in range(len(S)):
            new_S = S[:i] + S[j:]
            if new_S == "keyence":
                print "YES"
                return

    print "NO"

if __name__ == '__main__':
    main()

Solution (Python):
need = "keyence"
s = input()
n = len(s)
m = len(need)
ir = set()
ir.add(s)
for i in range(1, m+1):
    if n >= i and n - m + i + 1 >= i:
        ir.add(s[0:i] + s[n - m + i:])

    
if need in ir:
    print("YES")
else:
    print("NO")

Solution (Python):



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


if __name__ == "__main__":
    solve()

Solution (Python):
S=raw_input()
key="keyence"

num=0
if S[0]=="k":
    num=1
    for i in range(1,7):
        if S[i]==key[i]:
            num+=1
        else:
            break
    if num==7:
        print "YES"
    else:
        for i in range(1,8-num):
            if S[-i]==key[-i]:
                num+=1
            else:
                break
        if num==7:
            print "YES"
                    
if num<7:
    for i in range(1,8):
        if S[-i]==key[-i]:
            num+=1
        else:
            break
    if num==7:
        print "YES"
    else:
        print "NO"

Solution (Python):



def solve():
    s = input()
    k = 'keyence'
    if s.startswith(k) or s.endswith(k):
        print("YES")
        return

    for i in range(len(k)):
        start = k[:i]
        end = k[i:]
        if s.startswith(start) and s.endswith(end):
            print("YES")
            return
    print("NO")

if __name__=="__main__":
    solve()

Solution (Python):
def main():
    kstring = input()

    elim_len = len(kstring) - 7

    for i in range(len(kstring) - elim_len + 1):
        cand_str = kstring[:i] + kstring[i+elim_len:]
        
        if cand_str == 'keyence':
            print('YES')
            return
    print('NO')
    return

main()

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