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 = False
for i in range(0, len(S)):
    for j in range(len(S)-i+1):
        ns = S[:j] + S[j+i:]
        if ns == 'keyence':
            ans = True
            break
    if ans:
        break
print('YES' if ans else 'NO')

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

n = len(S) - len(T)

j = 0
for i in range(7):
    if T[i] == S[i]:
        continue
    else:
        j = i
        break

print('YES' if T == S[:j]+S[j+n:] else 'NO')

Solution (Python):
import re
S = input()
k = 'keyence'
for i in range(0, len(k)+1):
    rs = '^' + k[:i] + '.*' + k[i:] + '$'
    if re.match(rs, S) is not None:
        print('YES')
        break
else:
    print('NO')

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

Solution (Python):
import sys
S = input()
_S = 'keyence'
_N = len(_S)
for i in range(_N + 1):
    if _S[:i] == S[:i] and _S[i:] == S[len(S) - _N + i:]:
        print('YES')
        sys.exit()
print('NO')

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

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

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

Solution (Python):
s = list(input())
k = ["k", "e", "y", "e", "n", "c", "e"]
ans = []
i = 0
while s[i] == k[i]:
    ans.append(s[i])
    i += 1
    if i == 7:
        break
for j in range(len(s) - 7 + i, len(s)):
    ans.append(s[j])

jud = True
for j in range(7):
    if ans[j] != k[j]:
        jud = False
if jud:
    print("YES")
else:
    print("NO")

Solution (Python):

import sys
from collections import defaultdict, deque




def solve():
    s = input()
    t = 'keyence'
    n = len(s)
    
    for i in range(n):
        for j in range(n - i):
            x = (s[:i] + s[i+j:])
            if x == t:
                print("YES")
                return



    print("NO")


t = 1

for case in range(1,t+1):
    ans = solve()

"""

"""

Solution (Python):
import re
s = input()
y = "YES"
n = "NO"
if s == "keyence":
    print(y)
elif re.fullmatch(r'[a-z]+keyence',s) != None:
    print(y)
elif re.fullmatch(r'k[a-z]+eyence',s) != None:
    print(y)
elif re.fullmatch(r'ke[a-z]+yence',s) != None:
    print(y)
elif re.fullmatch(r'key[a-z]+ence',s) != None:
    print(y)
elif re.fullmatch(r'keye[a-z]+nce',s) != None:
    print(y)
elif re.fullmatch(r'keyen[a-z]+ce',s) != None:
    print(y)
elif re.fullmatch(r'keyenc[a-z]+e',s) != None:
    print(y)
elif re.fullmatch(r'keyence[a-z]+',s) != None:
    print(y)
else:
    print(n)

Solution (Python):
s = input()

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

print("NO")

Solution (Python):
s=input()

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

Solution (Python):
def main():
    S = input()
    n = len(S)
    c = 0
    if S == 'keyence':
        print('YES')
        exit()
    for i in range(n):
        for j in range(i, n):
            s1 = S[:i] if i > 0 else ''
            s2 = S[j + 1:] if j + 1 < n else ''
            if s1 + s2 == 'keyence':
                print('YES')
                exit()
    print('NO')


if __name__ == '__main__':
    main()

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

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

s = input()

l = len(s)-7


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

print("YES")

Solution (Python):
s = input()

k = 'keyence'

ok = False
for i in range(8):
    if s[0:i] == k[0:i] and s[-7+i:] == k[-7+i:]:
        ok = True
        break

print('YES' if ok else 'NO')

Solution (Python):
S = input()

s = S.replace('keyence', '0')
lst = []
k = 'keyence'
jdg = False

if s[0] == '0' or s[-1] == '0':
    jdg = True
elif '0' in s:
    jdg = False
else:
    for i in range(1, len(k)):
        lst.append([k[:i], k[i:]])

    for i, j in enumerate(lst, start=1):
        if s[:i] == j[0] and s[i-7:] == j[1]:
            jdg = True
            break
if jdg: print('YES')
else: print('NO')

Solution (Python):
import sys

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

Solution (Python):





s = input()




K = 'keyence'

for i in range(len(s)):
    for j in range(len(s)):
        s1 = s[0:i]
        s2 = s[i:i + j]
        s3 = s[i + j:]

        
        if s1 == K or s2 == K or s3 == K or s1 + s2 == K or s1 + s3 == K or s2 + s3 == K:
            print('YES')
            exit()

print('NO')

Solution (Python):




import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy














S = input()

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

print("NO")

Solution (Python):




import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=SI()
for i in range(len(s)):
    for j in range(i,len(s)+1):
        s1=s[:i]
        s2=s[j:]
        if s1+s2=="keyence":
            print("YES")
            sys.exit()
print("NO")

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

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

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re











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

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

print('NO')

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

Solution (Python):
S = list(input())
N = len(S)
ans = 'NO'
for i in range(N):
    A = ''.join(S[:i] + S[N-7+i:])
    if A == 'keyence':
        ans = 'YES'
        break
print(ans)

Solution (Python):
S = input().strip()
N = len(S)
flag = 0
if S=="keyence":
    flag = 1
else:
    for i in range(N):
        for j in range(i,N):
            x = S[:i]
            y = S[j+1:]
            if x+y=="keyence":
                flag = 1
                break
        if flag==1:break
if flag==1:
    print("YES")
else:
    print("NO")

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

S = ins()
K = "keyence"


def solve():
    if len(S) < len(K):
        return False
    f = b = True
    x = y = 0
    ns = len(S)
    nk = len(K)
    for i in range(len(S)):
        if i < nk and S[i] == K[i]:
            if f:
                x += 1
        else:
            f = False
        if nk - 1 - i >= 0 and S[ns - 1 - i] == K[nk - 1 - i]:
            if b:
                y += 1
        else:
            b = False
    
    return x + y >= nk


print("YES" if solve() else "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"
n = len(S)-7

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

Solution (Python):
S = input();
str = 'keyence';
ans = 'NO'
if S[:7] == str :
    ans = 'YES';
elif S[-7:] == str :
    ans = 'YES';
else :
    for i in range(1,8) :
        if S[0:i] == str[0:i] and S[-7+i:] == str[-7+i:] :
            ans = 'YES';
            break;

print(ans);

Solution (Python):
s=input()
key="keyence"
li=[]
for i in range(len(key)):
  li.append([key[:i],key[i:]])
  
for i in li:
  
  if s[:len(i[0])]==i[0] and s[-len(i[1]):]==i[1]:
    print("YES")
    break
else:
  print("NO")

Solution (Python):

KEY = "keyence"

def main():
    s = input()

    if s.startswith(KEY) or s.endswith(KEY):
        print("YES")
        return

    for i in range(1, len(KEY)):
        st = KEY[0:i]
        ed = KEY[i:]

        if s.startswith(st) and s.endswith(ed):
            print("YES")
            return

    print("NO")

main()

Solution (Python):
import re
s = input()
pattern={
    '.*keyence'
    ,'k.*eyence'
    ,'ke.*yence'
    ,'key.*ence'
    ,'keye.*nce'
    ,'keyen.*ce'
    ,'keyenc.*e'
    ,'keyence.*'
    }

for p in pattern:
    if re.fullmatch(p, s):
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import sys

S = input()
num = len(S)

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

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

def range_strip(S, i, j):
    return S[:i] + S[j:]

for i in range(len(S)):
    for j in range(i, len(S)):
        if range_strip(S,i,j) == "keyence":
            print("YES")
            exit(0)
print("NO")

Solution (Python):

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

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

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")

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

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

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

elif S[:1] + S[-6:] == "keyence" or S[:2] + S[-5:] == "keyence" or S[:3] + S[-4:] == "keyence" or S[:4] + S[-3:] == "keyence" or S[:5] + S[-2:] == "keyence" or S[:6] + S[-1:] == "keyence":
    print("YES")
    exit()

else:
    print("NO")

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

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

elif S[:1]=="k" and S[l-6:]=="eyence":
  print("YES")

elif S[:2]=="ke" and S[l-5:]=="yence":
  print("YES")

elif S[:3]=="key" and S[l-4:]=="ence":
  print("YES")

elif S[:4]=="keye" and S[l-3:]=="nce":
  print("YES")

elif S[:5]=="keyen" and S[l-2:]=="ce":
  print("YES")

elif S[:6]=="keyenc" and S[l-1:]=="e":
  print("YES")

elif S[l-7:]=="keyence":
  print("YES")
else:
  print("NO")

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":
            ans = True

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

Solution (Python):
S = str(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):
def resolve():
    S = input()
    s = len(S) - 7
    if S == "keyence":
        print("YES")
    else:
        for i in range(len(S)-s-1):
            if S[:i+1]+S[i+s+1:] == "keyence":
                print("YES")
                exit()
        print("NO")
resolve()

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

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

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

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

elif S[:1]=="k" and S[l-6:]=="eyence":
  print("YES")

elif S[:2]=="ke" and S[l-5:]=="yence":
  print("YES")

elif S[:3]=="key" and S[l-4:]=="ence":
  print("YES")

elif S[:4]=="keye" and S[l-3:]=="nce":
  print("YES")

elif S[:5]=="keyen" and S[l-2:]=="ce":
  print("YES")

elif S[:6]=="keyenc" and S[l-1:]=="e":
  print("YES")

elif S[l-7:]=="keyence":
  print("YES")
else:
  print("NO")

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007



def main():
	
	
	s = input()
	key = 'keyence'
	for i in range(len(key)+1):
		if -len(key)+i < 0:
			ts=s[:i]+s[-len(key)+i:]
		else:
			ts = s[:i]
		pa(ts)
		if ts == key:
			return 'YES'
	return 'NO'
			
	
	

isTest=False
def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
def main():
    S = input()
    is_keyence = False
    string = "keyence"

    for i in range(len(string)):
        if S.startswith(string[:i]) and S.endswith(string[i:]):
            is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Solution (Python):
instring = input()
head_str = ""
foot_str = ""
ans_str = ""
ref = "keyence"
ref_rev = ref[::-1]
flag = False


start_index = 0
end_index = len(ref)-1

for i in range(len(instring)):
    head_str += instring[i]
    now_ref = ref[:(i+1)]
    
    if(head_str != now_ref):
        
        start_index = i
        flag = True
        break


if(flag):
    ans_str += head_str[:start_index]
else:
    ans_str = head_str

end_flag = False

if(ans_str == ref):
    print("YES")
    end_flag = True

ans_len = len(ans_str)    


for i in range(len(ref)-ans_len):        
    foot_str += instring[-(i+1)]
    now_ref = ref_rev[:(i+1)]
    if (foot_str != now_ref):
        end_index = i
        break


foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

if(end_flag != True):
    if(ans_str == ref):
        print("YES")
    else:
        print("NO")

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

Solution (Python):
s=input()

if s[:1]=="k" and s[len(s)-6:]=="eyence":
    print("YES")
elif s[:2]=="ke" and s[len(s)-5:]=="yence":
    print("YES")
elif s[:3]=="key" and s[len(s)-4:]=="ence":
    print("YES")
elif s[:4]=="keye" and s[len(s)-3:]=="nce":
    print("YES")
elif s[:5]=="keyen" and s[len(s)-2:]=="ce":
    print("YES")
elif s[:6]=="keyenc" and s[len(s)-1:]=="e":
    print("YES")
elif s[:7]=="keyence":
    print("YES")
elif s[len(s)-7:]=="keyence":
    print("YES")
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):
S = str(input())

flg = False

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

Solution (Python):
s = input()
ans_flag = False
if "keyence" in s:
  ans_flag = True
  
t = "keyence"
for i in range(1,7):
  first_half = t[:i]
  second_half = t[i:]
  if first_half == s[:len(first_half)]:
    if s[-len(second_half):] == second_half:
      ans_flag = True

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

Solution (Python):
S = input()
flag = False
if S.count('keyence') > 0:
    flag = True
else:
    key = 'keyence'
    i = 0
    while key[i] == S[i]:
        i += 1
    if key[i:] == S[-(7-i):]:
        flag = True
print('YES' if flag else 'NO')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


S = input()
N = len(S)

for l in range(N):
	for r in range(l, N):
		if S[:l] + S[r:] == "keyence":
			print("YES")
			break
	else:
		continue
	break
else:
	print("NO")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


S = input()

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

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

Solution (Python):
S=input()
if S=='keyence' or S[0:7]=='keyence' or S[-7:]=='keyence':
    print('YES')
    exit()
else:
    pass

if S[0]=='k':
    if S[-6:]=='eyence':
        print('YES')
        exit()
    else:
        pass
if S[:2]=='ke':
    if S[-5:]=='yence':
        print('YES')
        exit()
    else:
        pass
if S[:3]=='key':
    if S[-4:]=='ence':
        print('YES')
        exit()
    else:
        pass
if S[:4]=='keye':
    if S[-3:]=='nce':
        print('YES')
        exit()
    else:
        pass
if S[:5]=='keyen':
    if S[-2:]=='ce':
        print('YES')
        exit()
    else:
        pass
if S[:6]=='keyenc':
    if S[-1]=='e':
        print('YES')
        exit()
    else:
        pass
print('NO')

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

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

print("NO")

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

print("NO")

Solution (Python):
S = input()
N = len(S)
w = "keyence"
for i in range(7):
  if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
    print("YES")
    break
  elif i == 6:
    print("NO")

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    N = len(S)
    w = "keyence"
    for i in range(7):
        if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
            print("YES")
            break
    else: print("NO")

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
if N<n:
    flag = 0
else:
    flag = 0
    for i in range(7):
        for j in range(1,8):
            if S[:i]+S[-j:]==x:
                flag = 1
                break
        if flag==1:break
if flag==1:
    print("YES")
else:
    print("NO")

Solution (Python):
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s=input()

key = "keyence"

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

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

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

Solution (Python):






from collections import defaultdict











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

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

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

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

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

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

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

print(ans)

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

if s[0] != 'k' and s[-1] != 'e':
    print('NO')
else:
    if s[:7] == check or s[-7:] == check:
        print('YES')
        exit()
    else:
        for i in range(1, 7):
            if s[:i] + s[-(7 - i):] == check:
                print('YES')
                exit()
                
    print('NO')

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






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






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





S = S()
L = len(S)

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

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

print('NO')

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()
n = len(s)
interval = n - 7
flag = False
start = 0
end = interval
for i in range(n-interval):
    news = s[0:start] + s[end:]
    if news == 'keyence':
        print('YES')
        flag = True
        break
    start+=1
    end+=1
if not flag:
    print('NO')

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    is_keyence = False
    if S[:7] == "keyence":
        is_keyence = True
    elif S[-7:] == "keyence":
        is_keyence = True
    elif S[:1] == "k" and S[-6:] == "eyence":
        is_keyence = True
    elif S[:2] == "ke" and S[-5:] == "yence":
        is_keyence = True
    elif S[:3] == "key" and S[-4:] == "ence":
        is_keyence = True
    elif S[:4] == "keye" and S[-3:] == "nce":
        is_keyence = True
    elif S[:5] == "keyen" and S[-2:] == "ce":
        is_keyence = True
    elif S[:6] == "keyenc" and S[-1:] == "e":
        is_keyence = True

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


if __name__ == "__main__":
    main()