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):
A=["k","e","y","e","n","c","e"]
f=-1;p=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i]:
        p=p+1
      else:
        if A[0:p]+S[len(S)-(len(A)-p):len(S)]==A:
          f=1
          break
        else:
          f=0
          break
print("YES" if f==1 else "NO")

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

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

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

    print('NO')
    
main()

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

Solution (Python):
s = input()
ans = 'NO'
pattern = 'keyence'

for i in range(len(pattern) + 1):
    x = s[:i]
    y = s[::-1][:len(pattern) - i][::-1]
    if x + y == pattern:
        ans = 'YES'
        break

print(ans)

Solution (Python):
import re

def main():
    N = str(input())
    if re.match("^.*keyence$", N) or re.match("^k.*eyence$", N) or re.match("^ke.*yence$", N) or re.match("^key.*ence$", N) or re.match("^keye.*nce$", N) or re.match("^keyen.*ce$", N) or re.match("^keyenc.*e$", N) or re.match("^keyence.*$", N):
        print("YES")
    else:
        print("NO")



if __name__ == "__main__":
    main()

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

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

Solution (Python):
import re
def main():
  S = input()
  if 'keyence' in S:
    print('YES')
    return
  
  if re.match(r'^k[a-z]*eyence$', S) or re.match(r'^ke[a-z]*yence$', S) or re.match(r'^key[a-z]*ence$', S) or re.match(r'^keye[a-z]*nce$', S) or re.match(r'^keyen[a-z]*ce$', S) or re.match(r'^keyenc[a-z]*e$', S):
    print('YES')
  else:
    print('NO')
  return

if __name__ == '__main__':
  main()

Solution (Python):
s = input()

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

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

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

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

Solution (Python):
S=input()
length=len(S)
ans='NO'
if S[0:7]=='keyence':
    ans='YES'
elif S[-7:]=='keyence':
    ans='YES'
elif S[0]=='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):
import re
S=input()
keyence = 'keyence'
patterns = []
for i in range(len(keyence)):
    patterns.append('^'+keyence[:i]+'[a-z]*'+keyence[i:]+'$')
for p in patterns:
    if re.match(p,S):
        print('YES')
        exit()
print('NO')

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

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

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

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

for i in range(n):
	ss = s[::]
	for j in range(i, n):
		ss.pop(i)
		if "".join(ss) == "keyence":
			print("YES")
			break
	else:
		continue
	break
else:
	print("NO")

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = input()
    L = len(S)
    ans = 'NO'
    for i in range(0,8):
        s = S[:i] + S[L-7+i:]
        if s == 'keyence':
            ans = 'YES'
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):



s = input()
s_l = len(s)


is_ok = False


for i in range(s_l):
    for j in range(i, s_l):
        tmp_s = s[:i] + s[j:]
        if tmp_s=='keyence':
            is_ok = True
            break


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

Solution (Python):
def myAnswer(S:str) -> str:
   N = len(S) - 7
   for i in range(N,len(S)):
      
      if(S[:i-N]+S[i:] == "keyence"):
         return "YES"
   return "NO"



def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

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

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

print('NO')

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


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 lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



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

Solution (Python):
s = input()

l = len(s)
d = l - 7

for i in range(7):
    if s[:i] + s[(i + d):] == "keyence":
        print("YES")
        break
    elif i == 6:
        print("NO")

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

Solution (Python):
S = input()
if S == "keyence":
    print("YES")
    exit()
for s in range(len(S)):
    for e in range(s, len(S)):
        string = S[:s] + S[e:]
        if string == "keyence":
            print("YES")
            exit()
print("NO")

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

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

Solution (Python):
def resolve():
    '''
    code here
    '''

    S = input()

    is_flag = False
    key = 'keyence'

    for i in range(8):
        if i == 0:
            if S[-7:] == key:
                is_flag = True

        elif 1 <= i < 7:
            if S[:i] == key[:i] and S[-1*(7-i):] == key[-1*(7-i):]:
                is_flag = True
        else:
            if S[:7] == key:
                is_flag = True

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


if __name__ == "__main__":
    resolve()

Solution (Python):
S = input()
key = 'keyence'
ok = False
for i in range(8):
    
    if i == 7:
        j = S[:7]
    else:
        j = S[:i] + S[i-7:]
    if key == j:
        ok = True

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

Solution (Python):
s = list(input())
key = list("keyence")
index = 0
ans = "NO"
n = len(s)
for i in range(8):
    mid = n-7
    tmp = s[:i] + s[i+mid:]
    if tmp == key:
        ans = "YES"
print(ans)

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


ans = 0

for i in range(len(s)+1):
    for j in range(i, len(s) + 1):
        if s[:i] + s[j:] == list("keyence"):
            ans = 1
            break
if ans:
    print("YES")
else:
    print("NO")

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

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

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

print("NO")

Solution (Python):
s=input()
print('NYOE S'[any([s[:i]=='keyence'[:i] and s[len(s)-7+i:]=='keyence'[i:] for i in range(8)])::2])

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, 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
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")
			exit()
print("NO")

Solution (Python):
s = list(input())
l = len(s)
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']


ans_1 = True
for i in range(7):
    if s[i] == key[i]:
        pass
    else:
        ans_1 = False
if ans_1:
    print('YES')
    exit()
else:
    if l == 7:
        print('N0_1')
        exit()


ans_2 = True
for i in range(7):
    if s[l-7+i] == key[i]:
        pass
    else:
        ans_2 = False
if ans_2:
    print('YES')
    exit()


idx = 0
for i in range(7):
    if s[i] == key[i]:
        pass
    else:
        idx = i-1
        break
for i in range(6-idx):
    if s[l-6+idx+i] == key[idx+1+i]:
        pass
    else:
        print('NO')
        exit()
print('YES')

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

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

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

print("NO")

Solution (Python):
S = input()

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

print(res)

Solution (Python):


if False:
    print('YES' if set(input().split())==set(list('1974')) else 'NO')



if True:
    S=input()
    ans='NO'
    K='keyence'
    for i in range(len(S)-1):
        for j in range(i,len(S)):
            if S[:i+1]+S[j:]==K: ans='YES'
    print(ans)



if False:
    N=int(input())
    H=int(input())
    W=int(input())
    print((N-H+1)*(N-W+1))



if False:
    N=int(input())
    A,B=map(int,input().split())
    P=[int(i) for i in input().split()]
    cnt=[0,0,0]
    for p in P:
        if p<=A: cnt[0]+=1
        elif A<p<=B: cnt[1]+=1
        else: cnt[2]+=1
    print(min(cnt)) 



if False: print(input().count('2'))

Solution (Python):
s = input()

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

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

Solution (Python):



import re












S = input()

if S[:7] == "keyence" or S[-7:]=="keyence":
    print("YES")
    exit()
else:
    ans = "NO"
    for i in range(1,7):
        front = "keyence"[:i]
        back = "keyence"[i:]
        if S[:i] == front and S[-len(back):]==back:
            print("YES")
            exit()
    print(ans)

Solution (Python):
def myAnswer(S:str) -> str:
   if(S == "keyence"):return "YES"
   for i in range(len(S)-1):
      for j in range(i+1,len(S)):
         if(S[:i]+S[j:] == "keyence"):
            return "YES"
   return "NO"

def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

Solution (Python):
s = input()
len_s = len(s)
w = list("keyence")

ans = "NO"
if s[0:7] == "keyence":
    ans = "YES"
elif s[0] == "k" and s[len_s-6:] == "eyence":
    ans = "YES"
elif s[0:2] == "ke" and s[len_s-5:] == "yence":
    ans = "YES"
elif s[0:3] == "key" and s[len_s-4:] == "ence":
    ans = "YES"
elif s[0:4] == "keye" and s[len_s-3:] == "nce":
    ans = "YES"
elif s[0:5] == "keyen" and s[len_s-2:] == "ce":
    ans = "YES"
elif s[0:6] == "keyenc" and s[len_s-1:] == "e":
    ans = "YES"
elif s[len_s-7:] == "keyence":
    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+1, len(S)):
        if S[:i]+S[j:] == "keyence":
            print("YES")
            exit()

print("NO")

Solution (Python):
import re
m = re.match(r'^keyence$|^.*keyence$|^k.*eyence$|^ke.*yence$|^key.*ence$|^keye.*nce$|^keyen.*ce$|^keyenc(\D)+e$|^keyence.*$',input())
print('YES' if m else 'NO')

Solution (Python):
import re
m = re.match(r'^keyence$|^(\D+)keyence$|^k(\D+)eyence$|^ke(\D+)yence$|^key(\D+)ence$|^keye(\D+)nce$|^keyen(\D+)ce$|^keyenc(\D)+e$|^keyence(\D+)$',input())
print('YES' if m else 'NO')

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

Solution (Python):
s = input()
rev_s = s[::-1]

key = "keyence"
label = [[key[:i], key[i:][::-1]] for i in range(len(key)+1)]

flag = False
for i, l in enumerate(label):
  if s[:i] == l[0] and rev_s[:len(l[1])] == l[1]:
    flag = True
    break
print("YES" if flag else "NO")

Solution (Python):
INF = 10 ** 9
MOD = 10 ** 9 + 7
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  math import factorial


def main():
    s = input()
    K = 'keyence'
    if s[:7] == K or s[-7:] == K:
        print('YES')
        return
    ans = 'NO'
    for i in range(7):
        a = K[:i]
        b = K[i:]
        if s[:i] == a and s[-7+i:] == b:
            ans = 'YES'
            break
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    S = str(input())
    ls = len(S)

    for i in range(ls):
        for j in range(i, ls):
            if S[:i] + S[j:] == 'keyence':
                return 'YES'
    return 'NO'

print(main())

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        S=str(input())
        ls=len(S)

        if S=='keyence':
            return 'YES'
        else:



            for i in range(ls):
                for j in range(i+1,ls):
                    if S[:i]+S[j:]=='keyence':
                        return 'YES'
            return 'NO'
    print(main())



resolve()

Solution (Python):

import sys
s = input()
target = 'keyence'
for i in range(len(s)):
    for j in range(i, len(s)):
        sub = s[:i] + s[j:]
        if sub == target:
            print('YES')
            sys.exit()
print('NO')

Solution (Python):
s=input()

if s == 'keyence':
    print('YES')
    exit()
else:
    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()
l = len(s) - 7
print("YES" if any(s[:i] + s[i+l:] == "keyence" for i in range(8)) else "NO")

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

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

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

Solution (Python):
s=input();ans='NO'
if s == 'keyence':
    ans = 'YES'
l = len(s)
if len(s) >= 8:
    i = 0
    while i < 8:
        s0 = s[:i]+s[i+(len(s)-7):]
        if s0 == 'keyence':
            ans = 'YES'
            break
        i += 1
print(ans)

Solution (Python):

def is_keyence_string():
	for i in range(1, len(key)):
		left = key[:i]
		right = key[i-len(key):]
		
		if S.startswith(left) and S.endswith(right):
			return True
	
	return False


S = input().strip()
key = 'keyence'

if S.startswith(key):
	print('YES')
elif S.endswith(key):
	print('YES')
elif is_keyence_string():
	print('YES')
else:
	print('NO')

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

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

target = "keyence"
T = len(target)

for i in range(8):
    cand = S[:i] + S[N - T + i :]
    if cand == target:
        print("YES")
        break
else:
    print("NO")

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

    print("NO")
    return


main()

Solution (Python):
S = input()

s = 'keyence'
for i in range(1,len(S)):
    if S[:i] + S[i-7:] == s:
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    n=len(s)
    target="keyence"
    if s==target:
        print("YES")
        sys.exit()
    for i in range(n):
        for j in range(n):
            for k in range(i,j+1):
                
                s_exp=s[:i]+s[j+1:]
                if s_exp==target:
                    print("YES")
                    sys.exit()
    print("NO")



if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    n=len(s)
    target="keyence"
    if s==target:
        print("YES")
        sys.exit()
    for i in range(n):
        for j in range(n):
            for k in range(i,j+1):
                
                s_exp=s[:i]+s[j+1:]
                if s_exp==target:
                    print("YES")
                    sys.exit()
    print("NO")



if __name__=='__main__':
    main()

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

Solution (Python):
S=input()
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()
else:
  print("NO")

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

Solution (Python):
import sys
s = input()
l = len(s)
k = 'keyence' 
if l < 7:
    print('NO')
    sys.exit()
diff = l - 7
flag = False
for i,kk in enumerate(k):
    
    if s[:i+1] == k[:i+1] and s[i+diff+1:] == k[i+1:]:
        flag = True
if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
s=input()
p=[]
p.append(r'^keyence$')
p.append(r'(\D+)keyence$')
p.append(r'^k(\D+)eyence$')
p.append(r'^ke(\D+)yence$')
p.append(r'^key(\D+)ence$')
p.append(r'^keye(\D+)nce$')
p.append(r'^keyen(\D+)ce$')
p.append(r'^keyenc(\D+)e$')
p.append(r'^keyence(\D+)')
ans='NO'
import re
for pi in p:
    m=re.search(pi,s)
    if m and m.start()>-1:
        ans='YES'
        break
print(ans)

Solution (Python):
S = input()

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

Solution (Python):
S = input()

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

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

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

def ok(s):
    for i in range(len(s)+1):
        for j in range(i, len(s)+1):
            
            
            
            
            
            
            if s[:i] + s[j:] == "keyence":
                return True
    return False

def main():
    s = input().strip()
    print("YES" if ok(s) else "NO")

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
key = 'keyence'
ans = 'NO'
for i in range(7):
    f = key[:i]
    if S[:i] == f:
        if key[i:][::-1] == S[::-1][:7-i]:
            ans = 'YES'
            break
print(ans)

Solution (Python):
S = input()

lst = [S[:7]]
for i in range(7):
    temp = S[:i] + S[-7 + i:]
    lst.append(temp)

if 'keyence' in lst:
    print('YES')
else:
    print('NO')

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

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

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

Solution (Python):
import sys

s = input()

for i in range(8):
    ans = s[:i] + s[-(7-i):]
    if i == 7:
        ans = s[:7]
    
    if ans == 'keyence':
        print('YES')
        sys.exit()

print('NO')

Solution (Python):
S=input()
lists=list(S)
if S[:7]=='keyence':
    print('YES')
elif 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[1]=='k':
    if S[-6:]=='eyence':
        print('YES')
    else:
        print('NO')
else:
    print('NO')

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

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

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

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

Solution (Python):

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

Solution (Python):
S = list(input())
cnt = 0
flag = True
ans = "NO"
for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        S_copy = S.copy()
        del S_copy[i+1:j]
        
        if "".join(S_copy)=="keyence":
            ans = "YES"
print(ans)

Solution (Python):
s=input()

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

Solution (Python):
s=input()
t="keyence"
f=False
if s[0:7]==t:f=True
for x in range(8):
    if s[:x]==t[:x] and s[-7+x:]==t[-7+x:]:f=True
print("YES" if f else "NO")

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Solution (Python):
s = input()

ln = len(s)
ans = "NO"
for l in range(ln):
    for r in range(l, ln):
        key = s[:l] + s[r:]
        if key == "keyence":
            ans = "YES"

print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
import re
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    s = S()
    ANS = "keyence"
    for i in range(len(s) + 1):
        for j in range(i, len(s)):
            a = s[:i] + s[j:]
            if a == ANS:
                print("YES")
                return
            
            
    print("NO")

    return



if __name__ == '__main__':
    solve()