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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = input().strip()

target = 'keyence'

if target in s:
    print('YES')
    sys.exit(0)

for start in range(len(s)):
    for end in range(start + 1, len(s) + 1):
        copy_s = list(s)
        copy_s[start:end] = ''
        if ''.join(copy_s) == target:
            print('YES')
            sys.exit(0)
print('NO')

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

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

for i in range(len(S)):
  if s == S[:i] + S[len(S)-len(s)+i:]:
    ans = "YES"
    
print(ans)

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

Solution (Python):
import sys

input = sys.stdin.readline

S = input()
S = S.replace('\n','')
s_list = list(S)

K = "keyence"
k_list = list(K)

for start in range(len(s_list)):
    small_s_list = s_list[start:]
    if "".join(small_s_list)== K:
        print("YES")
        exit(0)

for end in reversed(range(len(s_list))):
    small_s_list = s_list[:end+1]
    if "".join(small_s_list)== K:
        print("YES")
        exit(0)
point = int(len(s_list)/2)
for delete_start in range(len(s_list)-point):
    if delete_start >= point:
        break
    for delete_end in reversed(range(len(s_list))):
        if delete_end < point:
            break
        small_s_list = s_list[:delete_start+1] + s_list[delete_end:]
        if "".join(small_s_list)== K:
            print("YES")
            exit(0)
print("NO")

Solution (Python):
s=input()
res='keyence'
n=len(s)
if s[0]!='k':
  if s[n-7:n]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[n-1]!='e':
  if s[:7]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[0]=='k' and s[n-1]=='e':
  lb=1
  while lb<6:
    if s[lb]==res[lb]:
      lb+=1
    else:
      break
  ub=1
  while ub<7-lb:
    if s[n-ub-1]==res[6-ub]:
      ub+=1
    else:
      break
  if ub+lb==7:
    print('YES')
  else:
    print('NO')

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

for i in range(8):
    if s[0:i] == kw[0:i] and s[-7 + i:] == kw[i:]:
        print('YES')
        break
else:
    print('NO')

Solution (Python):
import sys
import copy
import math
import itertools
import numpy as np
import re

S = input()
s = "keyence"
for i in range(len(S)):
    if re.fullmatch(s[:i]+".*"+s[i:],S):
        print("YES")
        sys.exit(0)

print("NO")

Solution (Python):
import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    key = "keyence"
    if key in S:
        print("YES")
        return

    for i in range(len(S) - 1):
        for j in range(i + 1, len(S)):
            if S[:i] + S[j:] == key:
                print("YES")
                return

    print("NO")
    return


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
s = input()
target = "keyence"

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

print("NO")

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

Solution (Python):
import re

s = input()
key = 'keyence'
ans = 'NO'
for i in range(len(key)):
    k1 = key[:i + 1]
    k2 = key[i + 1:]
    
    k1_temp = [m.span() for m in re.finditer(k1, s)]
    for j in range(len(k1_temp)):
        k2_temp= [m.span() for m in re.finditer(k2, s)]
        for k in range(len(k2_temp)):
            if k1_temp[j][1] == k2_temp[k][0]:
                ans = 'YES'
                break
            if  k1_temp[j][0] == 0 and k2_temp[k][1] == len(s):
                ans = 'YES'
                break
print(ans)

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

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

i = 0
while i<7 and S[i]==T[i]:
    i += 1
j = 0
while j<7 and S[N-1-j]==T[6-j]:
    j += 1
judge(i+j>=7,['YES','NO'])

Solution (Python):
S = input()

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

Solution (Python):
s=input()

n=len(s)
ans="NO"

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

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

if k in s:
  print('YES')
  exit()
if s[0] == 'k' and s[-1] == 'e':
  for i in range(len(s)):
    if s.startswith(k[:i]) and s.endswith(k[i:]):
      print('YES')
      exit()
print('NO')

Solution (Python):
def main():
    S = input()
    if S[0] != 'k':
        return ('NO')
    elif S == 'keyence':
        return ('YES')

    ans = 'keyence'
    i = 0
    j = 0
    while True:
        i += 1
        j += 1
        if S[i] != ans[j]:
            break

    
    num = 7-j
    cnt = 0
    while cnt < num:
        cnt += 1
        
        if S[-cnt] != ans[-cnt]:
            return ('NO')
    return ('YES')
print(main())

Solution (Python):
S = input()
if S == 'keyence':
    print('YES')
    exit()

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

Solution (Python):
def main():
    S = input()
    N = len(S)
    for i in range(N):
        for j in range(i, N+1):
            ans = []
            for k in range(N):
                if i <= k and k < j:
                    continue
                ans.append(S[k])
            if "".join(ans) == "keyence":
                print("YES")
                return
    print("NO")


if __name__ == '__main__':
    main()

Solution (Python):
S = input()

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

Solution (Python):
import copy
s=input()
check="keyence"
tmp=6
sNow=0
cNow=0

for i in s:
  sNow+=1
  if i == check[cNow]:
    cNow+=1
  else:
    break

if cNow == 7:
  print("YES")
  exit()


"""
sの最後が"keyence"の残りの文字と一致すればOK
例：keyaence
最初の"key"は合っているので，残りは"aence"の内"a"を除いたもの
cNow=3, 7-cNow=4
後ろの４文字が"ence"ならばYESとなる
"""
if check[cNow:] == s[-1*(7-cNow):]:
  print("YES")
else:
  print("NO")

Solution (Python):
def main():
    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
    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()
    n=len(s)
    for i in range(8):
        s1=s[:i]
        s2=s[n+i-7:]
 
        if s1+s2=="keyence":
            print("YES")
            exit()
    print("NO")
        








if __name__=="__main__":
    main()

Solution (Python):
import re
S=input()
if re.fullmatch(r"[a-z]*keyence",S)==None and re.fullmatch(r"k[a-z]*eyence",S)==None and re.fullmatch(r"ke[a-z]*yence",S)==None and re.fullmatch(r"key[a-z]*ence",S)==None and re.fullmatch(r"keye[a-z]*nce",S)==None and re.fullmatch(r"keyen[a-z]*ce",S)==None and re.fullmatch(r"keyenc[a-z]*e",S)==None and re.fullmatch(r"keyence[a-z]*",S)==None:
  print("NO")
else:
  print("YES")

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

Solution (Python):
s=input()
flag=False
ans='keyence'

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

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

if s[rem:] == 'keyence': 
    print('YES')
    exit()
for i in range(8):
    news = s[0:i] + s[i+rem:]
    if news == 'keyence':
        print('YES')
        break
else:
    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):
K = "keyence"
S = input()

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

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

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    S = input()
    l = len(S)
    m = l - 7

    def judge():
        for i in range(l - m + 1):
            first = S[:i]
            second = S[i + m:]
            if first + second == "keyence":
                return True
        return False

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


if __name__ == '__main__':
    main()

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

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

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


if __name__ == "__main__":
    main()

Solution (Python):

S = input()

is_keyence = 'NO'

for i in range(0, 8):
    if S[:i] + S[i - 7:] == 'keyence':
        is_keyence = 'YES'
        break

print(is_keyence)

Solution (Python):

S = input()

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

Solution (Python):
import sys, math
from functools import lru_cache
import numpy as np
from collections import defaultdict
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


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


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = 'NO'
    k = 'keyence'
    S = input().rstrip('\n')
    if S[:7] == k or S[-7:] == k:
        ans = 'YES'
    elif S[0] == k[0]:
        for i in range(1,len(k)):
            if S[i] != k[i]:
                if S[-(7-i):] == k[i:]:
                    ans = 'YES'
                    break
                else:
                  break
    print(ans)

if __name__ == '__main__':
    main()

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

if S == k:
    print("YES")
else:
    ans = "NO"
    s = S
    for i in range(8):
        S = list(s)
        del S[i:i+(len(S)-7)]
        if "".join(S) in k:
            ans = "YES"
            break
    
    print(ans)

Solution (Python):

import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


S = S()
cut_l = 0
cut_r = 0
for cut_l in range(len(S)):
    for cut_r in range(len(S)):
        
        
        if (S[:cut_l] + S[cut_r:] == 'keyence'):
            print('YES')
            exit()
print('NO')

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

Solution (Python):

S = list(input())

result = 'NO'
for i in range(len(S)):
    Scpy = S.copy()
    for j in range(i,len(S)):
        Scond = Scpy[:i]+Scpy[j:]
        if (''.join(Scond)) == ('keyence'):
            result = 'YES'
            break
    else:
        continue
    break
print(result)

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

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    key = "keyence"
    ans = False
    if s == key:
        ans = True
    for i in range(len(s)):
        for j in range(i+1,len(s)):
            ex = s[:i] + s[j:]
            if ex == key:
                ans = True
    print("YES" if ans else "NO")
main()

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    key_lst = []
    for i in range(0,8):
        key_lst.append(["keyence"[:i],"keyence"[i:]])
    ans = False
    for b,f in key_lst:
        st = s[:len(b)]
        go = s[len(s)-len(f):]
        if st == b and go == f:
            ans = True
    

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

Solution (Python):
s=input()
ans=False
for x in range(len(s)):
    for y in range(x,len(s)):
        if (s[:x]+s[y:])=='keyence':
            ans=True
if ans:
    print('YES')
else:
    print('NO')

Solution (Python):

s=input()
ans=False
for x in range(len(s)):
    for y in range(x,len(s)):
        if (s[:x]+s[y:])=='keyence':
            ans=True
if ans:
    print('YES')
else:
    print('NO')

Solution (Python):
S = input()
k = 'keyence'
Srev = S[::-1]
krev = k[::-1]

ans = 'NO'
for i in range(8):
    if S[:i]==k[:i] and Srev[:(7-i)]==krev[:(7-i)]:
        ans = 'YES'

print(ans)

Solution (Python):
s = input()
ok = False

if s.startswith('keyence'):
    ok = True
if s.startswith('k') and s.endswith('eyence'):
    ok = True
if s.startswith('ke') and s.endswith('yence'):
    ok = True
if s.startswith('key') and s.endswith('ence'):
    ok = True
if s.startswith('keye') and s.endswith('nce'):
    ok = True
if s.startswith('keyen') and s.endswith('ce'):
    ok = True
if s.startswith('keyenc') and s.endswith('e'):
    ok = True
if s.endswith('keyence'):
    ok = True

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

Solution (Python):
s = input()

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

print('NO')

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

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

for i in s:
    if n[0] == i:
        n = n[1:]
    else:
        break

for i in s[::-1]:
    if n == "":
        print("YES")
        exit()
    elif n[-1] == i:
        n = n[:-1]
    else:
        break

print("NO")

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

for i in s:
    if n[0] == i: 
        n = n[1:] 
    else:
        break

n = n[::-1]

for i in s[::-1]:
    if n == "":
        break
    elif n[0] == i:
        n = n[1:]
    else:
        break

if n == "":
    print("YES")
else:
    print("NO")

Solution (Python):
u=str(input())
S=u.replace(' ','z')
A=[]
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if i<=j:
            A.append(S.replace(S[i-1:j],'',1))
if 'keyence' in A:
    print('YES')
else:
    print('NO')

Solution (Python):
S = input()
c = "keyence"
if S[-7:] == c or S[:7] == c:
    print("YES")
else:
    for i in range(1, 7):
        c_, _c = c[:i], c[i:]
        if S[:i] == c_ and S[-(7-i):] == _c:
            print("YES")
            break
    else:
        print("NO")

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

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

Solution (Python):
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
else:
  print("YES")
  exit()
print("YES" if t+s[i-7:]==k else "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
s=input()
for i in range(len(s)):
    for j in range(i,len(s)):
        if s[:i]+s[j:]=="keyence":
            print("YES")
            sys.exit()
print("NO")

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

ok = False
if S.startswith(T) or S.endswith(T):
    ok = True
for i in range(1, 7):
    left = T[:i]
    right = T[i:]
    a = S.startswith(left)
    b = S.endswith(right)
    if a and b:
        ok = True
if ok:
    print("YES")
else:
    print("NO")

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

Solution (Python):
from sys import stdin

s = stdin.readline().strip()
t_len = len(s) - 7

if t_len == 0:
  if s == 'keyence': print('YES')
  else: print('NO')
  exit()
else:
  for i in range(7):
    if s[:i] + s[i+t_len:] == 'keyence':
      print('YES')
      exit()
      
print('NO')

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

Solution (Python):
S = input()

key = "keyence"

t = -1

for i in range(7):
    if not S[i] == key[i]:
        t = i
        break

if t == -1:
    t = 7

for i in range(1, 8):
    if not S[-i] == key[-i]:
        t += i - 1
        break

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

Solution (Python):
s=input()
x=len(s)-7
if x==0:
  if  s=='keyence':
    print('YES')
    exit()
  else:
    print('NO')
    exit()

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


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

Solution (Python):
s = input()

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

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

Solution (Python):
s = list(input())
ls = len(s)
key = "keyence"
if "".join(s) == key:
    print("YES")
    exit()
f = False
for l in range(ls):
    for r in range(l + 1, ls):
        f |= "".join(["".join(s[:l]), "".join(s[r:])]) == key

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

Solution (Python):
S = input()
T = "keyence"
for i in range(len(S)):
    for j in range(len(S)):
        if S[:i] + S[j:] == T:
            print('YES')
            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()
n = len(s)
for l in range(n):
    for r in range(n):
        ans = s[:l] + s[r:]
        if ans == 'keyence':
            print("YES")
            exit()
print("NO")

Solution (Python):
s=input()
if s[-7]+s[-6]+s[-5]+s[-4]+s[-3]+s[-2]+s[-1]=='keyence':
    print("YES")
    exit()
elif s[0]=='k':
    if s[-6]+s[-5]+s[-4]+s[-3]+s[-2]+s[-1]=='eyence':
        print("YES")
        exit()
    elif s[1]=='e':
        if s[-5]+s[-4]+s[-3]+s[-2]+s[-1]=='yence':
            print("YES")
            exit()
        elif s[2]=='y':
            if s[-4]+s[-3]+s[-2]+s[-1]=='ence':
                print("YES")
                exit()
            elif s[3]=='e':
                if s[-3]+s[-2]+s[-1]=='nce':
                    print("YES")
                    exit()
                elif s[4]=='n':
                    if s[-2]+s[-1]=='ce':
                        print("YES")
                        exit()
                    elif s[5]=='c':
                        if s[-1]=='e':
                            print("YES")
                            exit()
print("NO")

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

for i in range(len(n)):
    for j in range(i,len(n)):
        tmp = n[:]
        del tmp[i:j]
        if ''.join(tmp) == 'keyence':
            print('YES')
            exit()
else:
    print('NO')

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

Solution (Python):
import re

S=input()

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

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

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


s = input()
print(check(s))

Solution (Python):

import sys

s = input()
l = len(s) 
for i in range(l+1):
    for j in range(l+1):
        mozi1 = s[0:i]
        mozi2 = s[j:]
        if mozi1+mozi2 == "keyence":
            print("YES")
            sys.exit()
print("NO")

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

for start in range(n):
  for end in range(start, n):
    tmp_s = s[:start] + s[end:]
    if tmp_s == "keyence":
      print("YES")
      exit(0)

print("NO")

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

Solution (Python):
S = input()

k = 'keyence'
if S[:7] == k or S[-7:] == k:
    print('YES')
    exit()
for i in range(len(S)):
    if S[:i] != k[:i]:
        if S[-7+i-1:] == k[-7+i-1:]:
            print('YES')
            exit()
        else:
            print('NO')
            exit()
print('NO')

Solution (Python):
s=input()
n="keyence"
res=False
if s[:7]==n or s[-7:]==n:
    res=True
else:
    for i in range(7):
        if s[:i+1]+s[i-6:]==n:
            res=True
            break

x="YES" if res else "NO"
print(x)

Solution (Python):
s=input()
n="keyence"
res=False
if s[:8]==n or s[-7:]==n:
    res=True
else:
    for i in range(7):
        if s[:i+1]+s[i-6:]==n:
            res=True
            break

x="YES" if res else "NO"
print(x)

Solution (Python):
s = input()

ks = "keyence"

if s.startswith(ks) or s.endswith(ks):
  print("YES")
  exit(0)
  
for i in range(1, len(ks)):
  k1 = ks[:i]
  k2 = ks[i:len(ks)]
  if s.startswith(k1) and s.endswith(k2):
    print("YES")
    exit(0)

print("NO")

Solution (Python):
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    keyence = "keyence"
    S = readline().rstrip()
    for i in range(len(S)):
        for j in range(i, len(S)):
            s = "".join([S[:i], S[j:]])
            if s == keyence:
                print("YES")
                return
    print("NO")


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
l = len(s)
ans = "NO"
for i in range(l):
    for j in range(1, l):
        t = s.copy()
        del t[i:j]
        if t == ["k","e","y","e","n","c","e"]:
            ans = "YES"
            break
print(ans)

Solution (Python):
s=input()
k='keyence'
if k in s:
    exit(print('YES'))

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

Solution (Python):
s = input()
cond = False
key = "keyence"

for i in range(len(s)+1):
    for j in range(i, len(s)+1):
        mod_s = s[:i]+s[j:]
        if mod_s == key:
            cond = True


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

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

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

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

for i in range(6):
  check = S[:i+1] + S[i+(l-7)+1:]
  if check == 'keyence':
    print('YES')
    exit()
print('NO')
exit()

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

Solution (Python):
s = input()

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

for i in range(0,len(s)-1):
    for j in range(i+1,len(s)):
        if s[:i]+s[j:] == '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()
for k in range(len(S)):
    if S[i::i+8] == "keyence":
        print("YES")
        exit()
print("NO")

Solution (Python):

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

Solution (Python):
s = input()
key = 'keyence'
n = len(s)

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

Solution (Python):
s = input()
n = len(s)
t = 'keyence'
flg = False
for i in range(8):
  if i == 7:
    u = s[:7]
  else:
    u = s[:i] + s[i-7:]
  if u == t:
    flg = True
    break

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

Solution (Python):
s = input()

k = 'keyence'

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

print('NO')

Solution (Python):
s = input()
n = len(s)
k = 'keyence'
a = 0
b = 6

for i in range(n):
    if k[a] == s[i]:
        a += 1
    else:
        break
    if a == 7:
        break

for i in range(n)[::-1]:
    if k[b] == s[i]:
        b -= 1
    else:
        break
    if b == -1:
        break
    
b = 7 - b - 1
if a + b >= 7:
    print('YES')
else:
    print('NO')

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

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

for i in range(len(S)):
  for j in range(i,len(S)):
    s = "".join([S[:i],S[j:]])
    if s == original_str:
      print("YES")
      exit()
    
print("NO")

Solution (Python):
S = input()
original_str = "keyence"
length = 7

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

Solution (Python):
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

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

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

A="keyence"
F=(S==A)
for i in range(N):
    for j in range(i+1,N+1):
        F|=(S[:i]+S[j:]==A)

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

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

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