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:
S = input()
key = "keyence"
ans = "NO"
for i in range(len(S)):
    for j in range(i,len(S)):
        #print(S[:i]+S[j:])
        if S[:i] + S[j:] == key:
            ans = "YES"
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#キーエンスプログラミングコンテスト2019 B

import sys
import math
import bisect
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:
# keyence2019B - KEYENCE String
def main():
    S = input()
    N = len(S)
    for i in range(N):
        for j in range(i, N):
            s = S[:i] + S[j:]
            if s == "keyence":
                print("YES")
                return
    print("NO")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

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

print("NO")

Submission status: Accepted

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

ans = "NO"
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if S[:i]+S[j:] == keyword:
            ans = "YES"
            
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

k = 'keyence'
ans = False
for i in range(8):
    if k[0:i] == s[0:i] and k[i:8] == s[-(7 - i):]:
        ans = True
        break
print('YES' if ans else 'NO')

Submission status: Accepted

Solution code:
s=input()
ans=0
t="keyence"
if s[:7]==t or s[-7:]==t:
    ans=1
for i in range(1,7):
    if s[:i]==t[:i] and s[-7+i:]==t[-7+i:]:
        ans=1
print(["NO","YES"][ans])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

N = len(S)
str = "keyence"
ans = False

if S[-1]+S[N-7:] == str:
    ans = True
for i in range(8):
    if S[:i]+S[N-7+i:] == str:
        ans = True

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

Submission status: Accepted

Solution code:
N=input()
flag = 0
l=len(N)
if l != 7:
        for i in range(7):
                g=N[0:i]+N[i+l-7:l]
                if g=='keyence':flag=1
        if flag==1:print("YES")
        else :print("NO") 
elif N=='keyence':print("YES")
else :print("NO")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
MOD = 10**9 + 7
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

S = input()
N = len(S)

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

for l_omit in range(N+1):
  for r_omit in range(l_omit, N+1):
    if S[0:l_omit] + S[r_omit:N] == 'keyence':
      print('YES')
      exit()

print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
X = "keyence"
ans = "YES" if S==X else "NO"
for l in range(N):
    for r in range(l+1,N):
        T = S[:l]+S[r:]
        if T==X: ans="YES"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input().rstrip()
k = "keyence"
for i in range(0, 7):
    t = s[:i] + s[::-1][:7-i][::-1]
    if t == "keyence":
        print("YES")
        exit()
print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
key = 'keyence'
l = len(S)
ans = 0
stop = 7

for i in range(7):
    if S[i] == key[i]:
        ans += 1
    else:
        stop = i
        break

if stop == 7:
    print('YES')
else:
    for i in range(stop,7):
        if S[l - 7 + i] == key[i]:
            ans += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# keyence2019B - KEYENCE String
def main():
    S = input()
    n = len(S)
    K = "keyence"
    for i in range(n):
        for j in range(i, n):
            s = S[:i] + S[j:]
            if s == K:
                print("YES")
                return
    else:
        print("NO")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().rstrip()

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

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

Submission status: Accepted

Solution code:
s=input()
flag=0
for i in range(7):
  if s[:i]+s[-(7-i):]=="keyence":
    flag=1
    break
if s[:7]=="keyence":
  flag=1
if flag==1:
  print("YES")
else:
  print("NO")

Submission status: Accepted

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


def solve() -> str:
    for i in range(len(S)):
        for j in range(i, len(S)):
            if S[:i] + S[j:] == K:
                return 'YES'
    return 'NO'


print(solve())

Submission status: Accepted

Solution code:
s = input()
ans = "NO"
ls = len(s)
if s[:7] == "keyence":
    ans = "YES"
elif s[-7:] == "keyence":
    ans = "YES"
else:
    for i in range(6):

        if s[:i+1]+s[ls-6+i:] == "keyence":
            ans = "YES"
print(ans)

Submission status: Accepted

Solution code:
def solve(s, t="keyence"):
    if s == t:
        return "YES"
    n = len(s)
    for i in range(n):
        for j in range(i+1,n):
            if s[:i] + s[j:] == t:
                return "YES"
    return "NO"

s = input()
print(solve(s))

Submission status: Accepted

Solution code:
S=input()

if S.startswith("keyence") or S.endswith("Keyence"):
  print("YES")
elif S.startswith("k") and S.endswith("eyence"):
  print("YES")
elif S.startswith("ke") and S.endswith("yence"):
  print("YES")
elif S.startswith("key") and S.endswith("ence"):
  print("YES")
elif S.startswith("keye") and S.endswith("nce"):
  print("YES")
elif S.startswith("keyen") and S.endswith("ce"):
  print("YES")
elif S.startswith("keyenc") and S.endswith("e"):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
keyence = 'keyence'
S = input()
flag = False
for i in range(len(keyence)+1):
    flag |= (S[:i]==keyence[:i] and S[-(len(keyence)-i):]==keyence[i:])
if(flag):
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
from sys import exit, stdin
s = list(stdin.readline().rstrip())
len_s = len(s)
for i in range(len_s):
  for j in range(len_s):
    if ''.join(s[:i]+s[i+j:]) == 'keyence':
      print('YES')
      exit()
print('NO')

Submission status: Accepted

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

ans='NO'

for i in range(len(s)+1):
    for j in range(len(s)+1):
        if i <= j:
            if s[:i]+s[j:] ==t:
                ans='YES'
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

key = 'keyence'
ans = 'NO'

for i in range(len(S)):
    for j in range(len(S)):
        ss = S[:i] + S[j:]
        if ss == key:
            ans = 'YES'
            break

print(ans)

Submission status: Accepted

Solution code:
S = input()

ans = 'keyence'
p = 0
for s in S:
    if s == ans[p]:
        p += 1
    else:
        break
for i in range(7 - p):
    if S[::-1][i] != ans[::-1][i]:
        print('NO')
        exit()
    p += 1

print('YES')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
for l in range(n):
    for r in range(l,n):
        s1=s[:l]
        s2=s[l:r+1]
        s3=s[r+1:]
        if s1+s3=="keyence" or s=="keyence":
            print("YES")
            exit()
print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
key='keyence'
if S[:7] == key or S[-7:] == key:
    print('YES')
    exit()
for i in range(len(S)):
    if S[i] != key[i]:
        left = i
        break
for i in range(len(S)):
    if S[-i-1] != key[-i-1]:
        right = i
        break
print('YES' if left + right >= 7 else 'NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

bl = False
for L in range(8):
  T = S[:L] + S[len(S)-(7-L):]
  if T == 'keyence':
    bl = True
    break

answer = 'YES' if bl else 'NO'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())
N =len(S)
flag = False
for i in range(N+1):
    for j in range(i,N+1):
        s = S[:i] + S[j:]
        # print (i, j, s)
        if 'keyence' == s:
            flag = True

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

Submission status: Accepted

Solution code:
s = input()

c_word ='keyence'


if c_word in s:
    print("YES")
else:
    for i in range(1, 7):
        w_a = c_word[:i]
        w_b = c_word[i:]

        if s.find(w_a) == 0 and s[len(w_a):][::-1].find(w_b[::-1]) == 0:
            print("YES")
            exit(0)
    else:
        print("NO")

Submission status: Accepted

Solution code:
s = input()

len_s = len(s)

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

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
KEYENCE = "keyence"


isKeyence = False
for i in range(len(S)):
    for j in range(i, len(S)):
        s = S[:i] + S[j:]
        if s == KEYENCE:
            isKeyence = True
if isKeyence:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

if S.startswith(K) or S.endswith(K):
    print('YES')
    exit()

l = 0
r = -1

while True:
    break_flag = False

    if S[l] == K[l]:
        l += 1
    else:
        break_flag = True

    if S[r] == K[r]:
        r -= 1
    elif break_flag:
        print('NO')
        break

    if l > 7 + r:
        print('YES')
        break

Submission status: Accepted

Solution code:
a = input()
for i in range(7):
  b = a[:i] + a[len(a)-7+i:]
  if b == 'keyence':
    print('YES')
    e = 0
    break
  else:
    e = 1
if e == 1:
  print('NO')

Submission status: Accepted

Solution code:
S = (input())
N = len(S)
flag = False
for i in range(N-1):
    for j in range(i,N):
        s = S[:i] + S[j:]
        if s=='keyence':
            flag = True
            break
        
if flag:
    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)):
        s = S[:i] + S[j:]
        if s == 'keyence':
            flag = True

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

Submission status: Accepted

Solution code:
import re

S = input()
pattern = r"(.*keyence|k.*eyence|ke.*yence|key.*ence|keye.*nce|keyen.*ce|keyenc.*e|keyence.*)"
if re.fullmatch(pattern, S) is None:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
import re

S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
l="keyence"
x=0
for i in range(7):
    if s[i]==l[i]:x+=1
    else:break
for i in range(1,8):
    if s[-i]==l[-i]:x+=1
    else:break
print("YNEOS"[x<7::2])

Submission status: Accepted

Solution code:
k = "keyence"
S = input()
num = len(k)
rem = len(S) - num

flag = False
if S == k:
    flag = True

for i in range(len(S)-rem):
    if S[0:i] + S[i+rem:] == k:
        flag = True
if flag:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
S = input()
remove_num = len(S) - 7
yes = False
for i in range(len(S) - remove_num):
    tmp = S[:i] + S[i + remove_num:]
    if tmp == "keyence":
        yes = True
        break

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - KEYENCE String
https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

"""
import sys


def solve(S):
    l = len('keyence')
    diff = len(S) - l
    if diff < 0:
        return 'NO'
    for i in range(len(S)):
        t = S[:i] + S[i+diff:]
        if t == 'keyence':
            return 'YES'
    return 'NO'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
k="keyence"
flag=0
for i in range(8):
  if s[:i]+s[-(7-i):]==k:
    flag=1
print("YES" if flag==1 else "NO")

Submission status: Accepted

Solution code:
S=input()
flag=0
if (S.startswith("k") and S.endswith("eyence")) or \
(S.startswith("ke") and S.endswith("yence")) or \
(S.startswith("key") and S.endswith("ence")) or \
(S.startswith("keye") and S.endswith("nce")) or \
(S.startswith("keyen") and S.endswith("ce")) or \
(S.startswith("keyenc") and S.endswith("e")) or \
("keyence" in S):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
S = input()
if len(S) == 7:
  print(['NO','YES']["keyence"==S])
  exit()
i = 0
while i < 7 and S[i] == "keyence"[i]:
  i += 1
  
j = -1
while j >= -7 and S[j] == "keyence"[j]:
  j -= 1
  
j *= -1
j -= 1
print(['NO','YES'][i+j>=7])

Submission status: Accepted

Solution code:
def chk(S):
    for l in range(len(S)):
        for i in range(len(S)-l):
            if S[:i]+S[i+l:] == "keyence":
                return True
    return False
print("YNEOS"[not chk(input())::2])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(8):
  #print(S[:i], S[len(S)-7+i:], K[:i], K[i:])
  if S[:i] == K[:i] and S[len(S)-7+i:] == K[i:]:
    print('YES')
    break
  else:
    continue
else:
  print('NO')

Submission status: Accepted

Solution code:
S = input()

s = "keyence"
ans = s in S
for i in range(1, len(s)):
    s1 = s[:i]
    s2 = s[i:]
    if S.startswith(s1) and S.endswith(s2):
        ans = True

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

Submission status: Accepted

Solution code:
S = input()
flag = 0
for i in range(1,7):
    if S[:i] + S[-(7-i):] == "keyence":flag = 1
print('YES' if flag else 'NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__=="__main__":
    sub = 'keyence'
    s = input()
    for i in range(len(s)):
        for j in range(i, len(s)):
            if sub == s[0:i] + s[j:]:
                print('YES')
                exit(0)
    print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
key = "keyence"
n_key = len(key)

for i in range(n_key + 1):
    if S[0:i] + S[N - (n_key - i):] == key:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a="keyence"
s=input()
ans=1
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[:i]+s[j:]==a:
      ans=0
print("YNEOS"[ans::2])

Submission status: Accepted

Solution code:
S = input()
result = None
for i in range(1, len(S)):
    for j in range(2, len(S)):
        if S[:i] + S[j:] == 'keyence':
            result = True
            break
        else:
            result = False
    if result:
        break

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

Submission status: Accepted

Solution code:
import sys
string = input()

excess = len(string)-7

if excess != 0:
        for i in range(8):
                if string[:i] + string[i+excess:] == "keyence":
                        print('YES')
                        sys.exit()
        print('NO')
else:
        if string == "keyence":
                print('YES')
        else:
                print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = len(s) - 7

print('YES' if any(s[:i] + s[i+t:] == 'keyence' for i in range(8)) else 'NO')

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)-5):
  S_cut = S[:i]+S[i+len(S)-7:]
  #print(S_cut)
  if S_cut=='keyence':
    print('YES')
    exit()
print('NO')

Submission status: Accepted

Solution code:
S = input()
keyence = []
s = 'keyence'
List = []
flag = False

for i in range(len(s)):
    keyence.append([s[:i], s[i:]])

for i in range(len(s)):
    List.append([S[:i], S[-(len(s)-i):]])

for i in keyence:
    if i in List:
        flag = True
        break

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()

d = len(s)-7
for i in range(len(s)-d+1):
    ns = ""
    for j in range(len(s)):
        if j >= i and j < i+d:
            continue
        ns += s[j]

    if ns == "keyence":
        print("YES")
        exit()
print("NO")

Submission status: Accepted

Solution code:
S = input()


ans = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
i = 0
isKEYENCE = True
for s in S:
    if s == ans[i]: i += 1
    else: break

for j in range( len(S)-(7-i), len(S) ):
    if S[j] == ans[i]: i += 1
    else: 
       isKEYENCE = False
       break

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

Submission status: Accepted

Solution code:
l="keyence"
i=input()
if i[:7]==l or i[-7:]==l: 
    print("YES")
    exit()
for s in range(1,7):
    if (l[:s] in i) and (l[s:] in i):
        if (i.find(l[:s]) < i.find(l[s:])) and (i.find(l[:s])==0 and i[-1]=="e"):
            print("YES")
            exit()
print("NO")

Submission status: Accepted

Solution code:
import re
r=re.compile(r'^keyence$|^.+keyence$|^k.+eyence$|^ke.+yence$|^key.+ence$|^keye.+nce$|^keyen.+ce$|^keyenc.+e$|^keyence.+$')
print('YES') if len(r.findall(input()))>0 else print('NO')

Submission status: Accepted

Solution code:
#!/usr/bin/python3

s = input().strip()
t = "keyence"
for x in range(0,len(t)+1):
	if s.startswith(t[:x]) and s.endswith(t[x:]):
		print("YES")
		exit(0)

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
ans = ['k','e','y','e','n','c','e']
for i in range(len(S)):
    for j in range(i,len(S)):
        new_str = S[:i] + S[j:]
        if new_str == ans:
            print("YES")
            break
    else:
        continue
    break
else:
    print("NO")

Submission status: Accepted

Solution code:
import re

key_string = raw_input()

if re.search('^.*keyence$', key_string) or re.search('^k.*eyence$', key_string) or re.search('^ke.*yence$', key_string) or \
   re.search('^key.*ence$', key_string) or re.search('^keye.*nce$', key_string) or re.search('^keyen.*ce$', key_string) or \
   re.search('^keyenc.*e$', key_string) or re.search('^keyence.*$', key_string):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
s = input()
a = "keyence"
b = 0
if s[:7] == a:
  b = 1
for i in range(7):
  if s[:i] == a[:i] and s[i-7:] == a[i:]:
    b = 1
    break
if b:
  print("YES")
else:
  print("NO")

Submission status: Accepted

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

#A
s = S()
n = len(s)
if s == list("keyence"):
    print("YES")
    quit()
for i in range(n):
    for j in range(i+1,n):
        if s[:i]+s[j:] == list("keyence"):
            print("YES")
            quit()
print("NO")
#B
"""
c = LIR(3)
v = [[] for i in range(4)]
for i in range(3):
    c[i][0] -= 1
    c[i][1] -= 1
    v[c[i][0]].append(c[i][1])
    v[c[i][1]].append(c[i][0])

for i in range(4):
    li = [True for i in range(4)]
    li[i] = False
    q = [i]
    c = 0
    while q:
        x = q.pop(-1)
        k = 0
        for j in v[x]:
            if li[j]:
                li[j] = False
                q.append(j)
                if k == 0:
                    c += 1
                    k += 1
    if c == 3:
        print("YES")
        quit()
print("NO")
"""

#C
"""
n = I()
ng = IR(3)
if n in ng:
    print("NO")
    quit()
ng.sort()
for i in range(100):
    b = n
    n -= 3
    if n in ng:
        while n in ng:
            n += 1
            if n == b:
                print("NO")
                quit()
if n <= 0:
    print("YES")
else:
    print("NO")
"""

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input();print('NYOE S'['f'>s[-1]and'ke'in s::2])

Submission status: Accepted

Solution code:
s=input();print('NYOE S'['e'==s[-1]and'ke'in s::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
str1 = "keyence"
count = 0

for i in range(8):
  if(i != 7):
   str2 = S[:i] + S[-(7-i):]
  else:
   str2 = S[:i]
  #print(str2)
  if(str2 == str1):
   print("YES")
   count = 1
   break 
if(count != 1):
    print("NO")

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = 'keyence'
    for i in range(7):
        if s[:i] + s[-(7-i):] == t:
            return 'YES'

    return 'NO'



print(main())

Submission status: Accepted

Solution code:
import re
str = input()
k1 = re.compile(".*keyence$")
k2 = re.compile("^k.*eyence$")
k3 = re.compile("^ke.*yence$")
k4 = re.compile("^key.*ence$")
k5 = re.compile("^keye.*nce$")
k6 = re.compile("^keyen.*ce$")
k7 = re.compile("^keyenc.*e$")
k8 = re.compile("^keyence.*")

if (re.match(k1, str) is not None) or (re.match(k2, str) is not None) or (re.match(k3, str) is not None) or (re.match(k4, str) is not None) or (re.match(k5, str) is not None) or (re.match(k6, str) is not None) or (re.match(k7, str) is not None) or (re.match(k8, str) is not None):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
s=input()
z=[]
for i in range(len(s)):
    z.append(s[:i]+s[i+len(s)-7:])
print("YES" if "keyence" in z else "NO")