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



Sample input:
keyofscience


Sample output:
YES

Submission status: Accepted

Solution code:
# coding: utf-8

def is_keyence(target: str):
    key = "keyence"

    if target == key:
        return True

    for i in range(len(target)):
        for j in range(i, len(target)):
            tmp = ""
            if i > 0:
                tmp += target[0:i]
            if j < len(target) - 1:
                tmp += target[j + 1:]
            if tmp == key:
                return True
    return False


print("YES" if is_keyence(input().rstrip()) else "NO")

Submission status: Accepted

Solution code:
S = input()
s = 'keyence'

ans = 'NO'
for i in range(len(s)):
    judge = True
    for j in range(i):
        if S[j] != s[j]: judge = False
    for j in range(-1,-len(s)+i-1,-1):
        if S[j] != s[j]: judge = False
    if judge: ans ='YES'
print(ans)

Submission status: Accepted

Solution code:
S=input()
tgt="keyence"
res=S==tgt
for i in range(8):
    T = ''
    if 0<i: T+=S[:i]
    if i<7: T+=S[i-7:]
    #print(T)
    if T==tgt:
        res=True
print("YES" if res else "NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = False
for sta in range(len(S)):
    for end in range(sta, len(S)):
        if S[:sta] + S[end:] == "keyence":
            flag = True

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

Submission status: Accepted

Solution code:
s = input()
k = "keyence"
j = 0
"""
for i in range(len(s)):
    if s[i]==k[j]:
        j+=1
    if j==7:
        print("YES")
        exit()
"""
#部分列を取り除けるのは一度だけ
for i in range(7):
    if s[:i]+s[-7+i:]==k:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

Solution code:
s=str(input())
num=len(s)-7

ans="NO"

if num==0:
    if s=="keyence":
        ans="YES"

s=s+"!"

s1=""
s2=s[0:num]
s3=s[num:]

for _ in range(8):
    if s1+s3=='keyence!':
        ans="YES"
        break
    s1=s1+s2[0]
    s2=s2[1:]+s3[0]
    s3=s3[1:]

print(ans)

Submission status: Accepted

Solution code:
s = input()

master = "keyence"

i = 0
f = 0

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
s1=""
s2=""
s3=""
flag=0
keyence="keyence"
for i in range(1,N):
    for j in range(i+1,N):
        for k in range(N):
            if k<i:
                s1="".join((s1,S[k]))
            elif k<j:
                s2="".join((s2,S[k]))
            else:
                s3="".join((s3,S[k]))
        #print(s1,s2,s3,sep="|")
        if ("".join((s1,s2))==keyence)or("".join((s1,s3))==keyence)or("".join((s2,s3))==keyence)or("".join((s1,s2,s3))==keyence):
            flag=1
            break
        s1=""
        s2=""
        s3=""
    if flag==1:
        break
if flag==1:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ans="NO"
t="keyence"
for i in range(8):
    if s[:i]==t[:i] and s[len(s)-7+i:]==t[i:]:
        ans="YES"
        break
print(ans)

Submission status: Accepted

Solution code:
s = input()
t = 'keyence'
for i in range(8):
  #print(t[:i],t[i-7:])
  if s[:i] == t[:i] and s[i-7:] == t[i-7:]:
    print('YES')
    break
else:
  print('NO')

Submission status: Accepted

Solution code:
s = input()

def main(string):
    c = "keyence"
    head = string[:7]

    idx = 0
    for s in head:
        if s == c[idx]: idx += 1
        else: break
    if idx == 7:
        print("YES")
        return

    tail = string[-7+idx:]
    for s in tail:
        if s == c[idx]: idx += 1
        else: break        
    
    if idx == 7:
        print("YES")
    else:
        print("NO")

main(s)

Submission status: Accepted

Solution code:
Key_str = 7

S = str(input())
count =0

if len(S)<Key_str:
    print("No")

else:
    del_str = len(S)-Key_str
    
    for i in range(len(S)-del_str):
        try_str = S[:i] + S[i+del_str:]
        if try_str == 'keyence':
            print("YES")
            count+=1
            break
    if count==0:
        print("NO")

Submission status: Accepted

Solution code:
s = input()
k = "keyence"
a = "YES"
for i in range(len(s)):
    if s[i] == k[i]: continue
    else:
        if s[-(7-i):] == k[i:]:
            break
        else:
            a = "NO"
            break
print(a)

Submission status: Accepted

Solution code:
S=input()
a=1
for i in range(len(S)):
  for j in range(len(S)-i):
    if S[:i]+S[i+j:]=='keyence':
      a=0
print('YNEOS'[a::2])

Submission status: Accepted

Solution code:
S=input()
T="keyence"
for i in range(len(T)+1):
    if S.startswith(T[:i])and S.endswith(T[i:]):
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
c=0
if 'keyence' in s:
  c=1
if s[:1]=='k' and s[-6:]=='eyence':
  c=1
if s[:2]=='ke' and s[-5:]=='yence':
  c=1
if s[:3]=='key' and s[-4:]=='ence':
  c=1
if s[:4]=='keye' and s[-3:]=='nce':
  c=1
if s[:5]=='keyen' and s[-2:]=='ce':
  c=1
if s[:6]=='keyenc' and s[-1:]=='e':
  c=1

print('YES' if c==1 else 'NO')

Submission status: Accepted

Solution code:
s = input()
k = 'keyence'
res = 'NO'
if s[:len(k)]==k or s[len(s)-len(k):]==k:
    res = 'YES'
else:
    for i in range(len(k)+1):
        if s[:i]+s[len(s)-len(k)+i:] == k:
            res = 'YES'
            break
print(res)

Submission status: Accepted

Solution code:
S = input()
Flg = "NO"

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

Submission status: Accepted

Solution code:
S = input()

ans = False
if S == 'keyence':
    ans = True
else:
    for i in range(len(S)):
        for j in range(i, len(S)):
            p1 = S[:i]
            b = S[i:j+1]
            p2 = S[j+1:]
            # print('--')
            # print(i, j)
            # print(p1, b, p2)
            # print(p1 + p2)
            if p1 + p2 == 'keyence':
                ans = True

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

Submission status: Accepted

Solution code:
S = input()

ans = False
if S == 'keyence':
    ans = True
elif S.startswith('keyence') or S.endswith('keyence'):
    ans = True
else:
    for i in range(len(S)):
        for j in range(i, len(S)):
            p1 = S[:i]
            b = S[i:j+1]
            p2 = S[j+1:]
            # print(p1, b, p2)
            if p1 + p2 == 'keyence':
                ans = True

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

Submission status: Accepted

Solution code:
s = input()
import re
if "keyence" == s:
    print("YES")
    exit()

if re.fullmatch(".*keyence",s) is not None:
    print("YES")
    exit()

if re.fullmatch("k.*eyence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("ke.*yence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("key.*ence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keye.*nce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyen.*ce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyenc.*e",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyence.*",s) is not None:
    print("YES")
    exit()
print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
def worstdata():
    a=0
    return a
#solution:
def vacation(N,act):
    lastact =[]
    dp=[0,max(act[0])]*(N+1) #[i]日目のActivity で得られる最大幸福量
    
    return 0

#input


S=input()
window=len(S)-7
k="keyence"
cond=0
for i in range(7):
    c=S[0:i]+S[i+window:]
    #print(c)
    if c==k:
        cond=1
        break
#output
#print(solution(H,N))
print(["NO","YES"][cond])

Submission status: Accepted

Solution code:
s = input()
key = 'keyence'

if len(s) < len(key):
    print('NO')
else:
    for i in range(len(key)):
        if s[:i] + s[-7+i:] == key:
            print('YES')
            break
    else:
        print('NO')

Submission status: Accepted

Solution code:
def examA():
    N = LI()
    N.sort()
    if N==[1,4,7,9]:
        print("YES")
    else:
        print("NO")
    return

def examB():
    S = SI()
    K = "keyence"
    for i in range(7):
        if S[:i]+S[-7+i:]==K:
            print("YES")
            return
    if S[:7]==K:
        print("YES")
        return
    print("NO")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Accepted

Solution code:
S = input()
flag = False
for L in range(8):
	T = S[:L] + S[len(S)-(7-L):]
	if T == "keyence":
		flag = True
		break
print("YES" if flag else "NO")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

s=input()
m="keyence"
if s=="keyence":
    print("YES")
elif s[0:7]=="keyence":
    print("YES")
elif s[-8:-1]=="keyence":
    print("YES")
elif s[0]=="k" and s[-1]=="e":
    ans = "NO"
    for i in range(6):
        if s[0:i+1]==m[0:i+1] and s[-6+i:]==m[-6+i:]:
            ans="YES"
    print(ans)

else:
    print("NO")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	S = sys.stdin.readline()

	counter = 0
	if(S[0]!='k'):
		if(S[-8:-1]=='keyence'):
			print("YES")
		else:
			print("NO")
	elif(S[0]=="k" and S[-2]!="e"):
		if(S[0:7]=='keyence'):
			print("YES")
		else:
			print("NO")
	elif(S[0]=="k" and S[-2]=="e"):
		key = "keyence"
		f = False
		for i in range(1,7):
			if(key == str(S[0:i])+str(S[-8+i:-1])):
				print("YES")
				f = True
				break
		if f==False : print("NO")
	else:
		print("NO")

main()

Submission status: Accepted

Solution code:
s=str(input())
if s=="keyence":
  print("YES")
  exit()
f=False
for i in range(len(s)-1):
  for j in range(i+1,len(s)):
    if s[:i]+s[j:]=="keyence":
      f=True
      break
print("YES" if f==True else "NO")

Submission status: Accepted

Solution code:
S = input()


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

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

Submission status: Accepted

Solution code:
s = input()
end = len(s)
flg = False
for i in range(end):
    for j in range(i,end):
        string = s[:i] + s[j:]
        if string == 'keyence':
            flg = True
            break
            
print('YES' if flg else 'NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

S = list(input().strip())

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

Submission status: Accepted

Solution code:
s = input()
l = "keyence"
if s[0:7] == l:
    print("YES")
elif s[-7:] == l:
    print("YES")
else:
    for i in range(7):
        if s[:i+1] == l[:i+1] and s[i-6:] == l[i+1:]:
            print("YES")
            exit()
    print("NO")

Submission status: Accepted

Solution code:
S = input()
ky = "keyence"
for i in range(len(ky)):
    s = ky[:i]
    t = ky[i:]
    if s in S and t in S:
        if s == S[:i] and t == S[i-7:]:
            print("YES")
            exit()
print("NO")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    s = input()
    WORD = 'keyence'

    l = len(s)
    for i in range(l):
        for j in range(i, l):
            if s[:i] + s[j:] == WORD:
                print('YES')
                exit()
    print('NO')
    
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    for l in range(len(s)):
        for r in range(l,len(s)):
            a = s[:l]+s[r:]
            if a == "keyence":
                print("YES")
                return
    print("NO")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
s = input()

k = 'keyence'

tmp = s
ans = ''
for i in range(len(s)-1):
  for j in range(i, len(s)):
    tmp = s
    tmp = tmp[0:i] + tmp[j:]
    if k == tmp:
      print('YES')
      exit(0)
print('NO')

Submission status: Accepted

Solution code:
S = input()
id = 0
keyence = "keyence"
for i in range(len(S)):
    if S[i] == keyence[id]:
        id += 1
    else:
        break
id2 = 1
for i in reversed(range(id, len(S))):
    if S[i] == keyence[-id2]:
        id2 += 1
    else:
        break

if id + id2 - 1 >= 7:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC140 E
#類題 AGC5 B

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

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
k = 'keyence'
for i in range(7):
    if s[i] != k[i]:
        break
else:
    i += 1
tmp = i
for i in range(7):
    if s[n - i - 1] != k[6 - i]:
        break
else:
    i += 1
if i + tmp >= 7:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
def main():
    s = input()

    good = 'keyence'

    for start in range(len(s)):
        for end in range(len(s)):
            if s.replace(s[start:end],'',1) == good:
                print('YES')
                exit()

    print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
keyence = "keyence"

S = input()

flag = False
for sta in range(len(S)):
    for end in range(sta,len(S)):
        if S[:sta] + S[end:] == keyence:
            flag = True

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
cnt = 0
for i in range(len(s)):
    for j in range(len(s)):
        if s[:i]+s[j:] == 'keyence':
            cnt += 1
if cnt > 0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    N = len(S)
    for l in range(N):
        for r in range(l,N):
            if S[:l]+S[r:]=="keyence":
                print("YES")
                return
    print("NO")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()

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

# main()
print(main())

Submission status: Accepted

Solution code:
S = input()
s = 'keyence'
if S[:7] == s or S[-7:] == s:
    print('YES')
    exit()

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

Submission status: Accepted

Solution code:
S=input()
count= 0
for i in range(len(S)):
    for j in range(len(S)):
        if S[:i]+S[j:]=="keyence":
            count += 1
if count == 0:
    print("NO")
else:
    print("YES")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# B 
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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()) #整数map取得
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# keyenceが先頭にある場合と最後にある場合、それ以外は真ん中にある場合
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")