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

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

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

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

k=0
ans="NO"
if N>=Nsk:
    for i in range(Nsk):
        temp=S[0:i]+S[N-Nsk+i:]
        if temp==sk:
            ans="YES"
    
print(ans)

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

Solution (Python):
l = list(input())
ans = list("keyence")

minus = len(l)-7

for i in range(len(l)-minus):
  l1 = l[:i]+l[i+minus:]
  
  if l1 == ans:
    print("YES")
    exit()
    
print("NO")

Solution (Python):
S=input()
T='keyence'
if S.count(T)>0:
  print('YES')
  exit()
  
for i in range(1, 7):
  if S[:i]==T[:i] and S[-7+i:]==T[-7+i:]:
    print('YES')
    exit()
    
print('NO')

Solution (Python):
S = input()
k = 'keyence'
n = len(S) - len(k)

ans = 'NO'
for i in range(len(S)-n):
    tmp = S[:i] + S[i+n:]
    if tmp == k:
        ans = 'YES'
        break

print(ans)

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
s=si()
n=len(s)
for i in range(n):
    for j in range(n-i+1):
        t=s
        t=t[:j]+t[j+i+1:]
        if t=='keyence':
            print('YES')
            exit()
print('NO')

Solution (Python):
import sys
S = input()
if len(S)==7:
    if S == 'keyence':
        print('YES')
        sys.exit()


    else:
        print('NO')
        sys.exit()

red = len(S)-7
for i in range(0,len(S)-red+1):
    new = list(S)
    del new[i:i+red]
    news = ''

    for j in new:
        news += j


    if news == 'keyence':
        print('YES')
        sys.exit()

print('NO')

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

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


if __name__ == '__main__':
    solve()

Solution (Python):
from copy import deepcopy
def main():
    S = list(input())

    for i in range(len(S)):
        for j in range(i,len(S)+1):
            now = deepcopy(S)
            del now[i:j]
            if "".join(now)=="keyence":
                print("YES")
                exit()
    print("NO")
if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin

s = stdin.readline().rstrip()
key = "keyence"

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

print("NO")

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

for i in range(len(s)):
    for g in range(i,len(s)):
        if "keyence"==s[:i]+s[g:]:
            print("YES")
            sys.exit()
print("NO")

Solution (Python):
S=input()
len_S=len(S)
len_SS=len_S-7
ans='keyence'

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

S_lst=list(S)

for i in range(len_S):
    for j in range(len_SS+1):
        lst=S_lst[:]
        del lst[i:i+j]
        if ''.join(lst)==ans:
            print('YES')
            exit()
print('NO')

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

if ''.join(s)=='keyence':
    print('YES')
    flag=True
    
else:
    for i in range(n):
        for j in range(i,n):
            t=s.copy()
            del t[i:j+1]
            if ''.join(t)=='keyence':
                print('YES')
                flag=True
                break
        if flag:
            break

if not flag:
    print('NO')

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def 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 is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime
def run_length_encode(s):
    count = 1
    code = []
    target = s[0]
    for i in range(1, len(s)):
        if target == s[i]: count += 1
        else:
            code.append((target, count))
            target = s[i]
            count = 1
    code.append((target, count))
    return code

S = input()

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

Solution (Python):
S = input()

KEYENCE = 'keyence'
Answer = 'NO'
if S[0:7] == KEYENCE:
  Answer = 'YES'
elif S[0] == 'k':
  counter = 1
  for i in range(6):
    if S[i+1]==KEYENCE[i+1]:
      counter +=1
  if S[-(7-counter):] ==KEYENCE[counter:]:
    Answer = 'YES'

elif S[-7:] == KEYENCE:
  Answer = 'YES'

print(Answer)

Solution (Python):
S=[i for i in list(input())];N=len(S);k=['k','e','y','e','n','c','e']
for d in range(N-6):
    for i in range(N-d+1):
        s=S[:i]+S[i+d:]
        if s==k:
            print('YES');quit()
print('NO')

Solution (Python):
S = [i for i in list(input())]
N = len(S)
k = [i for i in list('keyence')]

for d in range(N-6):
    for i in range(N-(d-1)):
        s = S[:i] + S[i+d:]
        if s==k:
            print('YES')
            quit()
print('NO')

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

Solution (Python):

s = input()
keyence = "keyence"
for i in range(len(keyence)):
    if s[: i + 1] == keyence[: i + 1] and s[-i + 1 :] == keyence[-i + 1]:
        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()
if (S[0:7] == 'keyence') or (S[-7:] == 'keyence'):
  print("YES")
else:
  flag = 0
  for i in range(1,7):
    if S[:i] + S[-(7-i):] == 'keyence':
      print("YES")
      flag=1
      break
  if flag==0:
    print("NO")

Solution (Python):
s=input()
n=len(s)
a=str()
b=str()
k='keyence'
l='ecneyek'
j=0
for i in range(n):
  if a+s[i] in k:
    a+=s[i]
    j=i+1
  else:
    break
for i in range(7-j):
  if b+s[n-i-1] in l:
    b+=s[n-i-1]
  else:
    break
if a+b[::-1]==k:
  print('YES')
else:
  print('NO')

Solution (Python):
s = input()
l = len(s)
cond = False
for i in range(8):
	if s[:i] + s[-(7-i):] == "keyence":
		cond = True

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

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

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

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

Solution (Python):
S = input()

flg = False
for i in range(len(S)):
    for j in range(len(S)-i):
        if S[:j]+S[j+i:] == 'keyence':
            flg = True
            break
    if flg: break

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

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

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

idx = 0
for i in range(len(s)):
    if i < len(t):
        if s[i] != t[i]:
            idx = i
            break
    elif i == len(t):
        print('YES')
        exit()

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

print('NO')

Solution (Python):
import sys

S = input()

K = len(S)-7
N = len(S)

for i in range(N-K+1):
    s = S[0:i] + S[i+K:]

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

print("NO")

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

Solution (Python):
import sys

S = input()

for i in range(7):

    
    if S[:i] + S[-(7-i):] == "keyence":
        print ("YES")
        sys.exit()

if S[:7] == "keyence":
    print ("Yes")
    sys.exit()
print ("NO")

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

s = 0
t = 0
while t < len(T) and s < len(S):
    if T[t] != S[s]:
        if T[t:] == S[-(len(T) - t):]:
            print('YES')
            exit()
        else:
            print('NO')
            exit()
        break
    t += 1
    s += 1

print('YES')

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

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

for i in range(0, 8):
	T = S[:i] + S[N-7+i:]
	if T == 'keyence':
		flg = 1

ans = 'YES' if flg else 'NO'
print(ans)

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

key = 'keyence'

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

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

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

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

Solution (Python):
S = input()

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

Solution (Python):
s=input()
ans = "NO"
l = len(s)
if s[:7] == "keyence" or s[-7:] == "keyence":
	ans = "YES"

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

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

flag = False
for i in range(N):
    for j in range(i, N):
        if S[:i]+S[j:] == A:
            flag = True

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

Solution (Python):
s = input()

keyence = 'keyence'

k = 0
while s[k] == keyence[k]:
    k += 1
    if k == 7:
        print('YES')
        exit()

t = k - 7
if s[t:] == keyence[t:]:
    print('YES')
else:
    print('NO')

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

Solution (Python):

import sys

YES = "YES"  
NO = "NO"  


def solve(S: str):

    N = len(S)
    if any([(S[0:i]+S[i+N-7:N]) == 'keyence' for i in range(N)]):
        print(YES)
    else:
        print(NO)


    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    solve(S)

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

keyence = "keyence"
ans = "NO"

for i in range(len(keyence) + 1):
  head, tail = keyence[:i], keyence[i:]
  if s.startswith(head) and s.endswith(tail):
    ans = "YES"
    
print(ans)

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

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



for i in range(len(a)):
    if a[:i] in s:
        b=s.index(a[:i])
        if b!=0:
            if i==len(a)-1:
                pass
            else:
                continue
        if a[i:] in s[b:]:
            c=s.index(a[i:])
            
            if s[c:]==a[i:]:
                print("YES")
                exit()
            else:
                while True:
                    
                    if c+1>=len(s):
                        break
                    if a[i:] in s[c+1:]:
                        
                        d=s[c+1:].index(a[i:])
                        if d==0:
                            if s[c+1:]==a[i:]:
                                print("YES")
                                exit()
                            else:
                                c+=1
                                continue
                        
                        c+=d
                        
                        if s[c:]==a[i:]:
                            print("YES")
                            exit()
                    else:
                        break
                    
                    
                    
                
print("NO")

Solution (Python):


s=list(input())
cnt=''
ans='NO'
for i in range(len(s)):
    for j in range(len(s)):
        if i<=j<=i+len(s)-8:
            continue
        cnt+=s[j]
    
    if cnt=='keyence':
        ans='YES'
        break
    else:
        cnt=''
print(ans)

Solution (Python):
s=list(input())
cnt=''
ans='NO'
for i in range(len(s)):
    for j in range(len(s)):
        if i<=j<=i+len(s)-8:
            continue
        else:
            cnt+=s[j]
    
    if cnt=='keyence':
        ans='YES'
        break
    else:
        cnt=''
print(ans)

Solution (Python):
s = input()

for l in range(len(s)-1):
    for r in range(l,len(s)):
        ss = s[:l]+s[r:]
        
        if ss == "keyence":
            print("YES")
            exit()
print("NO")

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

Solution (Python):
s = input()

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

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    s = list(str(input().rstrip('\n')))
    for i in range(len(s)):
        for j in range(i + 1, len(s)):
            if "".join(s[:i + 1] + s[j:]) == "keyence":
                print("YES")
                exit()
    print("NO")


if __name__ == '__main__':
    solve()

Solution (Python):

import sys
def main():
    s = sys.stdin.readline().rstrip()

    t = 'keyence'

    for i in range(8):
        if t[:i] == s[:i] and t[i:] == s[len(s)-7+i:len(s)]:
            ans = 'YES'
            break
    else:
        ans = 'NO'

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
def main():
    s = sys.stdin.readline().rstrip()

    t = 'keyence'
    for i in range(8):
        if t[:i] == s[:i] and t[i:] == s[-(7-i):]:
            ans = 'YES'
            break
    else:
        ans = 'NO'

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
S=input()
ks='keyence'
f=False
for i in range(8):
    
    if S[:i]==ks[:i] and S[-(7-i):]==ks[-(7-i):]: 
        f=True
        break

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

Solution (Python):
S = input()
if len(S) == 7:
  if S == "keyence":
    print("YES")
  else:
    print("NO")
  exit()
T = len(S) - 7
for i in range(1,T+1):
  tmp = ""
  l = 0
  while l + i < len(S):
    tmp = S[:l] + S[l+i:]
    if tmp == "keyence":
      print("YES")
      exit()
    l += 1
print("NO")

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

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

ok = False
for l in range(N):
  for r in range(l, N):
    if S[:l] + S[r:] == 'keyence':
      ok = True
if ok:
  print("YES")
else:
  print("NO")

Solution (Python):
s=input()

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

Solution (Python):
n=input()
a,b="keyence",0
for i,j in zip(a,n):
    if i==j:
        b+=1
    else:break
for i,j in zip(a[::-1],n[::-1]):
    if i==j:
        b+=1
    else:break
print("YES" if b>=7 else "NO")

Solution (Python):
import sys

stdin = sys.stdin
 
ni = lambda:int(ns())
na = lambda:list(map(int,stdin.readline().split()))
ns = lambda:stdin.readline().rstrip()  

S = ns()
start = 0
end = 0
S2 = 'keyence'
for i in range(7):
    if S[i] == S2[i]:
        start += 1
    else:
        break
for i in range(-1, -8, -1):
    if S[i] == S2[i]:
        end += 1
    else:
        break
print('YES' if start + end >= 7 else 'NO')

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

Solution (Python):
S = input()
goal = "keyence"
if S.startswith(goal) or S.endswith(goal):
    print("YES")
else:
    for i in range(len(S)-1):
        if S.startswith(goal[:len(S)-i]) and S.endswith(goal[len(S)-i:]):
            print("YES")
            exit(0)
    print("NO")

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

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

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



S = sys.stdin.readline().rstrip()


def solve(S):
    key = 'keyence'
    ok = False
    for i in range(len(S)):
        ok |= S.startswith(key[:i]) and S.endswith(key[i:])
    return ok


if solve(S):
    print('YES')
else:
    print('NO')

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

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

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

Solution (Python):
import re
S = input()
flag = False
res = re.match(r'.*keyence$',S)
if res :
  flag = True
res = re.match(r'^k.*eyence$',S)
if res :
  flag = True
res = re.match(r'^ke.*yence$',S)
if res :
  flag = True
res = re.match(r'^key.*ence$',S)
if res :
  flag = True
res = re.match(r'^keye.*nce$',S)
if res :
  flag = True
res = re.match(r'^keyen.*ce$',S)
if res :
  flag = True
res = re.match(r'^keyenc.*e$',S)
if res :
  flag = True
res = re.match(r'^keyence.*',S)
if res :
  flag = True
if flag :
  print('YES')
else :
  print('NO')

Solution (Python):
S=input()
k="keyence"
ans=False
if len(S)<len(k):
  ans=False
elif S[:len(k)]==k or S[-len(k):]==k:
  ans=True
else:
  for i in range(len(S)):
    if S[i]==k[i]:
      continue
    else:
      break
  rest=k[i:]
  if S[-len(rest):]==rest:
    ans=True
  else:
    ans=False
print(("NO","YES")[ans])

Solution (Python):
def main():
  s=input()
  k="keyence"
  if len(s)<7:
    print("NO")
    return
  if s[:7]==k or s[-7:]==k:
    print("YES")
    return
  for i in range(1,7):
    if s[:i]==k[:i] and s[i-7:]==k[i-7:]:
      print("YES")
      return
  print("NO")
main()

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

key = list("keyence")

for i in range(len(s)):
    if s[i] == key[i]:
        continue
    else:
        check = i
        break
else:
    print("YES")
    exit()
    
if key[check:] == s[check-7:]:
    print("YES")
else:
    print("NO")

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

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    
    if S.startswith('keyence'):
        print("YES")
        sys.exit()
        
    if S.endswith('keyence'):
        print("YES")
        sys.exit()
        
    key = "keyence"
    for i in range(1, len(key)):
        key_s = key[:i]
        key_e = key[i:]
        
        if S.startswith(key_s) and S.endswith(key_e):
            print("YES")
            sys.exit()
            
    print("NO")
    
if __name__ == "__main__":
	main()

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

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

Solution (Python):
def main():
    s = input()
    keyence = 'keyence'

    if keyence == s:
        print("YES")
        return

    List = []
    for i in range(len(keyence)):
        List.append((keyence[0:i], keyence[i:len(keyence)]))

    ans = "NO"

    for left, right in List:
        l = len(left)
        r = len(right)
        if s[0:l] == left and s[-r:] == right:

            ans = "YES"

    print(ans)
    return


main()

Solution (Python):
S = input()
keyence = 'keyence'
List = []
for i in range(len(keyence)):
  List.append((keyence[0:i],keyence[i:len(keyence)]))
Answer = 'NO'
for A,B in List:
  a = len(A)
  b = len(B)
  if S[0:a] == A and S[-b:] == B:
    Answer = 'YES'
    break
print(Answer)

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

Solution (Python):
s = input()

c = 'keyence'
flag = False
for i in range(8):
    if s[:i] == c[:i] and s[i-7:] == c[i:]:
        flag = True
        break

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

Solution (Python):
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in range(0,len(S)+1):
    for j in range(0,len(S)+1):
        if j >= i:
            if S[:i]+S[j:] == "keyence":
                flag = True
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = list(input())
n = len(s)
t = list('keyence')
ll = n - 7
for i in range(8):
    ss = s[::]
    for j in range(ll):
        del ss[i]
    if ss == t:
        print('YES')
        break
else:
    print('NO')

Solution (Python):
S = input()

for left in range(len(S) + 1):
    for right in range(len(S) + 1):
        T = list(S[:left]) + list(S[right:])
        if ''.join(T) == 'keyence':
            print('YES')
            exit()
print('NO')

Solution (Python):
S=input()
T="keyence"
X,Y=0,0
for i in range(7):
  if(S[i]==T[i]):
    X+=1;
  else:
    break
for i in range(7):
  if(S[len(S)-1-i]==T[6-i]):
    Y+=1;
  else:
    break
if(X+Y>=7):
  print("YES")
else:
  print("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):
s = input()
k = 'keyence'

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

if s[:len(k)] == k:
    print('YES')
    exit()

print('NO')

Solution (Python):
s=str(input())
n=len(s)
for i in range(n):
    for k in range(i,n):
        if s[:i]+s[k:]=='keyence':
            print('YES')
            break
    else:
        continue
    break
else:
    print('NO')

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

print("NO")

Solution (Python):
s = input()

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

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

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

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

Solution (Python):
s=input();n=len(s);print("YNEOS"[all(s[:i]+s[j:]!="keyence"for i in range(n)for j in range(i,n))::2])

Solution (Python):

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


print(ans)

Solution (Python):
s = input()

w = "keyence"
ans = "NO"


if s[:7] == w:
    ans = "YES"


if s[-7:] == w:
    ans = "YES"


for i in range(1, 7):
    ss = w[:i]
    tt = w[-7+i:]
    if s[: len(ss)] == ss and s[-len(tt):] == tt:
        ans = "YES"
        break

print(ans)

Solution (Python):

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

S = input()
target = 'keyence'

if S[0] != target[0]:
	if S[-7:] == target:
		print("YES")
	else:
		print("NO")
elif S[-1] != target[-1]:
	if S[0:7] == target:
		print("YES")
	else:
		print("NO")
else:
	num = 0
	i = 0
	while i < 7 and S[i] == target[i]:
		num += 1
		i += 1
	i = 0
	while i < 7 and S[-i-1] == target[-i-1]:
		num += 1
		i += 1
	if num >= 7:
		print("YES")
	else:
		print("NO")

Solution (Python):


import re

s=input()
k='keyence'
n=len(s)

if re.search(r'^keyence',s) or re.search(r'keyence$',s):
    ans='YES'

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