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()
K = 'keyence'

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

print('NO')

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

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

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

Solution (Python):
s=input()
s=':'+s+':'
t='keyence*'
fo,ba=0,0
while s[fo+1]==t[fo]:
    fo+=1
t='*keyence'
while s[ba-2]==t[ba-1]:
    ba-=1
if fo-ba>6:
    print('YES')
else:
    print('NO')

Solution (Python):
def main():

    S = input()
    n = len(S)
    if n < 7: return "NO"
    for i in range(7):
        if S[:i] + S[-7+i:] == "keyence":
            return "YES"
    return "NO"

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

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

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

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

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

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

if a==s[:7] or a==s[-7:]:
  print("YES")
else:
  i=0
  sw=0
  while 1:
    if a[i]==s[i]:
      i+=1
    else:
      break
  while 1:
    if a[i]==s[-7+i]:
      i+=1
    else:
      sw=1
      break
    if i==7:
      break
  print("NO" if sw==1 else "YES")

Solution (Python):
S = input()
target_S = "keyence"
flg = 0
 
if S.startswith(target_S) or S.endswith(target_S):
    flg = 1
else:
    for i in range(len(target_S)):
        target_left = target_S[:i]
        target_right = target_S[i:]
        
        if S.startswith(target_left) and S.endswith(target_right):
            flg = 1

print("YES") if flg == 1 else print("NO")

Solution (Python):
import re
S = input()
key = "keyence"
if re.fullmatch(r'(.*keyence)|(k.*eyence)|(ke.*yence)|(key.*ence)|(keye.*nce)|(keyen.*ce)|(keyenc.*e)|(keyence.*)', S):
    ans = True
else:
    ans = False



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

Solution (Python):
from re import fullmatch
S = input()
_s = "keyence"
flag = False
for i in range(len(_s)):
    tmp = fullmatch("(.*)" + _s[:i] + "(.*)" + _s[i:] + "(.*)", S)
    if tmp and sum([1 for j in range(1, 4) if tmp.group(j)]) <= 1:
        flag = True
print("YES") if flag else print("NO")

Solution (Python):
import re

def solve():
    S = input()
    for i in range(8):
        p = "keyence"
        p = p[:i] + ".*" + p[i:] 
        if re.fullmatch(p, S):
            return "YES"
    return "NO"

print(solve())

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

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

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


if __name__ == "__main__":
    resolve()

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

Solution (Python):
s=input();print("YNEOS"[all("keyence"[:i]!=s[:i]or"keyence"[i-7 or len(s):]!=s[i-7 or len(s):]for i in range(8))::2])

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

for i in range(8):
    if i==0:
        temp=S[L-7:L+1]
    elif 1<=i<=6:
        temp=S[0:i]+S[L+i-7:L+1]
    else:
        temp=S
    if temp == Key:
        print("YES")
        exit()
print("NO")

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

for i in range(8):
    if i==0:
        temp="".join(S[L-7:L+1])
    elif 1<=i<=6:
        temp="".join(S[0:i])+"".join(S[L+i-7:L+1])
    else:
        temp="".join(S)
    if temp == Key:
        print("YES")
        exit()
print("NO")

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

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
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')
elif s[:7] == 'keyence' or s[-7:] == 'keyence':
    print('YES')
else:
    print('NO')

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):
s = input()

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

print("NO")

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

ans = "NO"
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if S[:i]+S[j:] == keyword:
            ans = "YES"
            
print(ans)

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

Solution (Python):
s = input()

k = 'keyence'
ans = False
for i in range(8):
    if k[0:i] == s[0:i] and k[i:8] == s[-(7 - i):]:
        ans = True
        break
print('YES' if ans else 'NO')

Solution (Python):
s=input()
ans=0
t="keyence"
if s[:7]==t or s[-7:]==t:
    ans=1
for i in range(1,7):
    if s[:i]==t[:i] and s[-7+i:]==t[-7+i:]:
        ans=1
print(["NO","YES"][ans])

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

Solution (Python):
S = input()

N = len(S)
str = "keyence"
ans = False

if S[-1]+S[N-7:] == str:
    ans = True
for i in range(8):
    if S[:i]+S[N-7+i:] == str:
        ans = True

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

Solution (Python):
N=input()
flag = 0
l=len(N)
if l != 7:
        for i in range(7):
                g=N[0:i]+N[i+l-7:l]
                if g=='keyence':flag=1
        if flag==1:print("YES")
        else :print("NO") 
elif N=='keyence':print("YES")
else :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):

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
MOD = 10**9 + 7
sys.setrecursionlimit(10**7)

dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())


S = input()
N = len(S)

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

for l_omit in range(N+1):
  for r_omit in range(l_omit, N+1):
    if S[0:l_omit] + S[r_omit:N] == 'keyence':
      print('YES')
      exit()

print('NO')

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

Solution (Python):
S = input()
N = len(S)
X = "keyence"
ans = "YES" if S==X else "NO"
for l in range(N):
    for r in range(l+1,N):
        T = S[:l]+S[r:]
        if T==X: ans="YES"
print(ans)

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")

Solution (Python):
s = input().rstrip()
k = "keyence"
for i in range(0, 7):
    t = s[:i] + s[::-1][:7-i][::-1]
    if t == "keyence":
        print("YES")
        exit()
print("NO")

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

Solution (Python):
S = list(input())
key = 'keyence'
l = len(S)
ans = 0
stop = 7

for i in range(7):
    if S[i] == key[i]:
        ans += 1
    else:
        stop = i
        break

if stop == 7:
    print('YES')
else:
    for i in range(stop,7):
        if S[l - 7 + i] == key[i]:
            ans += 1

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

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

Solution (Python):

def main():
    S = input()
    n = len(S)
    K = "keyence"
    for i in range(n):
        for j in range(i, n):
            s = S[:i] + S[j:]
            if s == K:
                print("YES")
                return
    else:
        print("NO")


if __name__ == "__main__":
    main()

Solution (Python):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):

    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')

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

Solution (Python):
S = input().rstrip()

if S[:7] == 'keyence':
    print('YES')
    exit()
if S[-7:] == 'keyence':
    print('YES')
    exit()

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

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

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


def solve() -> str:
    for i in range(len(S)):
        for j in range(i, len(S)):
            if S[:i] + S[j:] == K:
                return 'YES'
    return 'NO'


print(solve())

Solution (Python):
s = input()
ans = "NO"
ls = len(s)
if s[:7] == "keyence":
    ans = "YES"
elif s[-7:] == "keyence":
    ans = "YES"
else:
    for i in range(6):

        if s[:i+1]+s[ls-6+i:] == "keyence":
            ans = "YES"
print(ans)

Solution (Python):
def solve(s, t="keyence"):
    if s == t:
        return "YES"
    n = len(s)
    for i in range(n):
        for j in range(i+1,n):
            if s[:i] + s[j:] == t:
                return "YES"
    return "NO"

s = input()
print(solve(s))

Solution (Python):
S=input()

if S.startswith("keyence") or S.endswith("Keyence"):
  print("YES")
elif 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):
keyence = 'keyence'
S = input()
flag = False
for i in range(len(keyence)+1):
    flag |= (S[:i]==keyence[:i] and S[-(len(keyence)-i):]==keyence[i:])
if(flag):
    print('YES')
else:
    print('NO')

Solution (Python):
from sys import exit, stdin
s = list(stdin.readline().rstrip())
len_s = len(s)
for i in range(len_s):
  for j in range(len_s):
    if ''.join(s[:i]+s[i+j:]) == 'keyence':
      print('YES')
      exit()
print('NO')

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

ans='NO'

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

Solution (Python):
s = input()

flag = False
for i in range(len(s)):
    for j in range(len(s)):
        if s[:i] + s[i+j:] == "keyence":
            flag = True
if flag:
    print("YES")
else:
    print("NO")

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

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

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

Solution (Python):
S = input()

key = 'keyence'
ans = 'NO'

for i in range(len(S)):
    for j in range(len(S)):
        ss = S[:i] + S[j:]
        if ss == key:
            ans = 'YES'
            break

print(ans)

Solution (Python):
S = input()

ans = 'keyence'
p = 0
for s in S:
    if s == ans[p]:
        p += 1
    else:
        break
for i in range(7 - p):
    if S[::-1][i] != ans[::-1][i]:
        print('NO')
        exit()
    p += 1

print('YES')

Solution (Python):
s=input()
n=len(s)
for l in range(n):
    for r in range(l,n):
        s1=s[:l]
        s2=s[l:r+1]
        s3=s[r+1:]
        if s1+s3=="keyence" or s=="keyence":
            print("YES")
            exit()
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')

Solution (Python):
S=input()
key='keyence'
if S[:7] == key or S[-7:] == key:
    print('YES')
    exit()
for i in range(len(S)):
    if S[i] != key[i]:
        left = i
        break
for i in range(len(S)):
    if S[-i-1] != key[-i-1]:
        right = i
        break
print('YES' if left + right >= 7 else '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')

Solution (Python):
S = input()

bl = False
for L in range(8):
  T = S[:L] + S[len(S)-(7-L):]
  if T == 'keyence':
    bl = True
    break

answer = 'YES' if bl else 'NO'
print(answer)

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

Solution (Python):
S = str(input())
N =len(S)
flag = False
for i in range(N+1):
    for j in range(i,N+1):
        s = S[:i] + S[j:]
        
        if 'keyence' == s:
            flag = True

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

Solution (Python):
s = input()

c_word ='keyence'


if c_word in s:
    print("YES")
else:
    for i in range(1, 7):
        w_a = c_word[:i]
        w_b = c_word[i:]

        if s.find(w_a) == 0 and s[len(w_a):][::-1].find(w_b[::-1]) == 0:
            print("YES")
            exit(0)
    else:
        print("NO")

Solution (Python):
s = input()

len_s = len(s)

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

print("NO")

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

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

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

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


isKeyence = False
for i in range(len(S)):
    for j in range(i, len(S)):
        s = S[:i] + S[j:]
        if s == KEYENCE:
            isKeyence = True
if isKeyence:
    print("YES")
else:
    print("NO")

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

if S.startswith(K) or S.endswith(K):
    print('YES')
    exit()

l = 0
r = -1

while True:
    break_flag = False

    if S[l] == K[l]:
        l += 1
    else:
        break_flag = True

    if S[r] == K[r]:
        r -= 1
    elif break_flag:
        print('NO')
        break

    if l > 7 + r:
        print('YES')
        break

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

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

Solution (Python):
S = input()

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

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

Solution (Python):
import re

S = input()
pattern = r"(.*keyence|k.*eyence|ke.*yence|key.*ence|keye.*nce|keyen.*ce|keyenc.*e|keyence.*)"
if re.fullmatch(pattern, S) is None:
    print("NO")
else:
    print("YES")

Solution (Python):
import re

S = input()

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

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

Solution (Python):
s=input()
l="keyence"
x=0
for i in range(7):
    if s[i]==l[i]:x+=1
    else:break
for i in range(1,8):
    if s[-i]==l[-i]:x+=1
    else:break
print("YNEOS"[x<7::2])

Solution (Python):
k = "keyence"
S = input()
num = len(k)
rem = len(S) - num

flag = False
if S == k:
    flag = True

for i in range(len(S)-rem):
    if S[0:i] + S[i+rem:] == k:
        flag = True
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()
remove_num = len(S) - 7
yes = False
for i in range(len(S) - remove_num):
    tmp = S[:i] + S[i + remove_num:]
    if tmp == "keyence":
        yes = True
        break

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

Solution (Python):

"""
B - KEYENCE String
https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

"""
import sys


def solve(S):
    l = len('keyence')
    diff = len(S) - l
    if diff < 0:
        return 'NO'
    for i in range(len(S)):
        t = S[:i] + S[i+diff:]
        if t == 'keyence':
            return 'YES'
    return 'NO'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

Solution (Python):
S=input()
flag=0
if (S.startswith("k") and S.endswith("eyence")) or \
(S.startswith("ke") and S.endswith("yence")) or \
(S.startswith("key") and S.endswith("ence")) or \
(S.startswith("keye") and S.endswith("nce")) or \
(S.startswith("keyen") and S.endswith("ce")) or \
(S.startswith("keyenc") and S.endswith("e")) or \
("keyence" in S):
    print("YES")
else:
    print("NO")

Solution (Python):
S = input()
if len(S) == 7:
  print(['NO','YES']["keyence"==S])
  exit()
i = 0
while i < 7 and S[i] == "keyence"[i]:
  i += 1
  
j = -1
while j >= -7 and S[j] == "keyence"[j]:
  j -= 1
  
j *= -1
j -= 1
print(['NO','YES'][i+j>=7])

Solution (Python):
def chk(S):
    for l in range(len(S)):
        for i in range(len(S)-l):
            if S[:i]+S[i+l:] == "keyence":
                return True
    return False
print("YNEOS"[not chk(input())::2])

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()
K = 'keyence'

for i in range(8):
  
  if S[:i] == K[:i] and S[len(S)-7+i:] == K[i:]:
    print('YES')
    break
  else:
    continue
else:
  print('NO')

Solution (Python):
S = input()

s = "keyence"
ans = s in S
for i in range(1, len(s)):
    s1 = s[:i]
    s2 = s[i:]
    if S.startswith(s1) and S.endswith(s2):
        ans = True

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

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

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

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

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

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

Solution (Python):
S = input()
N = len(S)
key = "keyence"
n_key = len(key)

for i in range(n_key + 1):
    if S[0:i] + S[N - (n_key - i):] == key:
        print("YES")
        exit()

print("NO")

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

Solution (Python):
a="keyence"
s=input()
ans=1
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[:i]+s[j:]==a:
      ans=0
print("YNEOS"[ans::2])

Solution (Python):
S = input()
result = None
for i in range(1, len(S)):
    for j in range(2, len(S)):
        if S[:i] + S[j:] == 'keyence':
            result = True
            break
        else:
            result = False
    if result:
        break

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

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

excess = len(string)-7

if excess != 0:
        for i in range(8):
                if string[:i] + string[i+excess:] == "keyence":
                        print('YES')
                        sys.exit()
        print('NO')
else:
        if string == "keyence":
                print('YES')
        else:
                print('NO')

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

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

Solution (Python):
s = input()
t = len(s) - 7

print('YES' if any(s[:i] + s[i+t:] == 'keyence' for i in range(8)) else 'NO')

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

Solution (Python):
S = input()
keyence = []
s = 'keyence'
List = []
flag = False

for i in range(len(s)):
    keyence.append([s[:i], s[i:]])

for i in range(len(s)):
    List.append([S[:i], S[-(len(s)-i):]])

for i in keyence:
    if i in List:
        flag = True
        break

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

Solution (Python):
S = input()

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

Solution (Python):
s = input()

d = len(s)-7
for i in range(len(s)-d+1):
    ns = ""
    for j in range(len(s)):
        if j >= i and j < i+d:
            continue
        ns += s[j]

    if ns == "keyence":
        print("YES")
        exit()
print("NO")

Solution (Python):
S = input()


ans = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
i = 0
isKEYENCE = True
for s in S:
    if s == ans[i]: i += 1
    else: break

for j in range( len(S)-(7-i), len(S) ):
    if S[j] == ans[i]: i += 1
    else: 
       isKEYENCE = False
       break

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

Solution (Python):
l="keyence"
i=input()
if i[:7]==l or i[-7:]==l: 
    print("YES")
    exit()
for s in range(1,7):
    if (l[:s] in i) and (l[s:] in i):
        if (i.find(l[:s]) < i.find(l[s:])) and (i.find(l[:s])==0 and i[-1]=="e"):
            print("YES")
            exit()
print("NO")

Solution (Python):
import re
r=re.compile(r'^keyence$|^.+keyence$|^k.+eyence$|^ke.+yence$|^key.+ence$|^keye.+nce$|^keyen.+ce$|^keyenc.+e$|^keyence.+$')
print('YES') if len(r.findall(input()))>0 else print('NO')

Solution (Python):


s = input().strip()
t = "keyence"
for x in range(0,len(t)+1):
	if s.startswith(t[:x]) and s.endswith(t[x:]):
		print("YES")
		exit(0)

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')
            break
    else:
        continue
    break
else:
    print('NO')

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

Solution (Python):
S = list(input())
ans = ['k','e','y','e','n','c','e']
for i in range(len(S)):
    for j in range(i,len(S)):
        new_str = S[:i] + S[j:]
        if new_str == ans:
            print("YES")
            break
    else:
        continue
    break
else:
    print("NO")

Solution (Python):
import re

key_string = raw_input()

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

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

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


s = S()
n = len(s)
if s == list("keyence"):
    print("YES")
    quit()
for i in range(n):
    for j in range(i+1,n):
        if s[:i]+s[j:] == list("keyence"):
            print("YES")
            quit()
print("NO")

"""
c = LIR(3)
v = [[] for i in range(4)]
for i in range(3):
    c[i][0] -= 1
    c[i][1] -= 1
    v[c[i][0]].append(c[i][1])
    v[c[i][1]].append(c[i][0])

for i in range(4):
    li = [True for i in range(4)]
    li[i] = False
    q = [i]
    c = 0
    while q:
        x = q.pop(-1)
        k = 0
        for j in v[x]:
            if li[j]:
                li[j] = False
                q.append(j)
                if k == 0:
                    c += 1
                    k += 1
    if c == 3:
        print("YES")
        quit()
print("NO")
"""


"""
n = I()
ng = IR(3)
if n in ng:
    print("NO")
    quit()
ng.sort()
for i in range(100):
    b = n
    n -= 3
    if n in ng:
        while n in ng:
            n += 1
            if n == b:
                print("NO")
                quit()
if n <= 0:
    print("YES")
else:
    print("NO")
"""

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

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

for i in range(len(A)):
  for j in range(len(A)):
    b =A[:i]+A[len(A)-j:len(A)]
    if b == "keyence":
      print("YES")
      exit()
    else:
      continue
print("NO")

Solution (Python):
s = str(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):
s=input();print('NYOE S'['f'>s[-1]and'ke'in s::2])

Solution (Python):
s=input();print('NYOE S'['e'==s[-1]and'ke'in s::2])

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

Solution (Python):
S = input()
str1 = "keyence"
count = 0

for i in range(8):
  if(i != 7):
   str2 = S[:i] + S[-(7-i):]
  else:
   str2 = S[:i]
  
  if(str2 == str1):
   print("YES")
   count = 1
   break 
if(count != 1):
    print("NO")