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 = list(input())
l = len(s)
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']

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

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

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

Submission status: Accepted

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

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

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

print("NO")

Submission status: Accepted

Solution code:
S = input()

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

print(res)

Submission status: Accepted

Solution code:
# 1
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_a
if False:
    print('YES' if set(input().split())==set(list('1974')) else 'NO')

# 2
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b
if True:
    S=input()
    ans='NO'
    K='keyence'
    for i in range(len(S)-1):
        for j in range(i,len(S)):
            if S[:i+1]+S[j:]==K: ans='YES'
    print(ans)

# 3
# https://atcoder.jp/contests/aising2019/tasks/aising2019_a
if False:
    N=int(input())
    H=int(input())
    W=int(input())
    print((N-H+1)*(N-W+1))

# 4
# https://atcoder.jp/contests/aising2019/tasks/aising2019_b
if False:
    N=int(input())
    A,B=map(int,input().split())
    P=[int(i) for i in input().split()]
    cnt=[0,0,0]
    for p in P:
        if p<=A: cnt[0]+=1
        elif A<p<=B: cnt[1]+=1
        else: cnt[2]+=1
    print(min(cnt)) 

# 5
# https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_a
if False: print(input().count('2'))

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
S = input()

if S[:7] == "keyence" or S[-7:]=="keyence":
    print("YES")
    exit()
else:
    ans = "NO"
    for i in range(1,7):
        front = "keyence"[:i]
        back = "keyence"[i:]
        if S[:i] == front and S[-len(back):]==back:
            print("YES")
            exit()
    print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

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+1, len(S)):
        if S[:i]+S[j:] == "keyence":
            print("YES")
            exit()

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

print(main())

Submission status: Accepted

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

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

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



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



resolve()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b
import sys
s = input()
target = 'keyence'
for i in range(len(s)):
    for j in range(i, len(s)):
        sub = s[:i] + s[j:]
        if sub == target:
            print('YES')
            sys.exit()
print('NO')

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

target = "keyence"
T = len(target)

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

Submission status: Accepted

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

    print("NO")
    return


main()

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    n=len(s)
    target="keyence"
    if s==target:
        print("YES")
        sys.exit()
    for i in range(n):#文字列開始
        for j in range(n):#文字列終了
            for k in range(i,j+1):
                #区間[i,j]が予想
                s_exp=s[:i]+s[j+1:]
                if s_exp==target:
                    print("YES")
                    sys.exit()
    print("NO")



if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
  for j in range(i,N):
    #print(S[:i],S[j:])
    if S[:i]+S[j:]==T:
      print("YES")
      exit()
else:
  print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def ok(s):
    for i in range(len(s)+1):
        for j in range(i, len(s)+1):
            # for k in range(len(s)):
            #     if i <= k and k < j:
            #         print("_", end="")
            #     else:
            #         print(s[k], end="")
            # print(" ", s[:i] + s[j:])
            if s[:i] + s[j:] == "keyence":
                return True
    return False

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

lst = [S[:7]]
for i in range(7):
    temp = S[:i] + S[-7 + i:]
    lst.append(temp)
#print(lst)
if 'keyence' in lst:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()

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

print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

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

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

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = input()
k = 'keyence'
flg_pre = 0
flg_post = 0
pre_match = 0
post_match = 0
if s[:6] == k or s[-7:] == k:
  print('YES')
else:
  for i in range(6):
    if s[i] == k[i] and flg_pre == 0:
      pre_match = i + 1
    else:
      flg_pre = 1
    if s[-i-1] == k[-i-1] and flg_post == 0:
      post_match = i + 1
    else:
      flg_post = 1
  if  pre_match + post_match >= 7:
    print('YES')
  else:
    print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    n = len(S)
    key = 'keyence'
    if S == key:
        print('YES')
        return
    for i, k in enumerate(key):
        if S[i] != k:
            rest = key[i:]
            for j in range(i, n):
                # 後方完全一致
                if S[j:] == rest:
                    print('YES')
                    return
            prinｔ('NO')
            return
    print('NO')
main()

Submission status: Accepted

Solution code:
S = input()

target = "keyence"
N = len(target)

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

Submission status: Accepted

Solution code:
import sys
s=input()
for i in range(len(s)):
    for j in range(i,len(s)):
        t=s[:i]+s[i:]
        if s[:i]+s[j:]=="keyence": print("YES");sys.exit()
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(0)
print('NO')

Submission status: Accepted

Solution code:
s = input()
rs = s[::-1]
for i in range(8):
    #print(s[:i], s[len(s)-(7-i):], s[:i]+s[len(s)-(7-i):])
    if s[:i]+s[len(s)-(7-i):] == 'keyence':
        print('YES')
        exit(0)
print('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")
            exit()

print("NO")

Submission status: Accepted

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

pre = 0
for c,t in zip(s[:7], key):
    if c == t:
        pre += 1
back = 0
for c,t in zip(s[-7:], key):
    if c == t:
        back += 1
        
print('YES' if pre + back >= len(key) else 'NO')

Submission status: Accepted

Solution code:
s = input()
ans = 'keyence'
cnt = 0

for i in range(7):
    if s[i] != ans[i]:
        break
    cnt += 1

for i in range(7):
    if s[len(s) - i - 1] != ans[6 - i]:
        break
    cnt += 1

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

Submission status: Accepted

Solution code:
s = input()
for start in range(len(s)):
    for end in range(start, len(s)+1):
        st = s[:start]+s[end:]
        if st=='keyence':
            print('YES')
            exit()

print('NO')

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 + 1, len(S) + 1):
        # print(i, j, S[i:j], S[:i] + S[j:], S[:i] + S[j:] == "keyence")
        if S[:i] + S[j:] == "keyence":
            print("YES")
            exit()

print("NO")

Submission status: Accepted

Solution code:
S = input()
li = ['k','ke','key','keye','keyen','keyenc']
lia = ['eyence','yence','ence','nce','ce','e']
for i in range(6):
    if S.startswith(li[i]) and S.endswith(lia[i]):
        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 + 1):
        if S[:i] + S[j:] == "keyence":
            print("YES")
            quit()
print("NO")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
def main():
    word = input()
    target = "keyence"
    target_length = len(target)
    answer = "NO"
    if word[:target_length] == target or word[-target_length:] == target:
        answer = "YES"
    else:
        for i in range(1, target_length):
            if word[:i] == target[:i] and word[-target_length + i:] == target[-target_length + i:]:
                answer = "YES"
                break
    print(answer)


if __name__ == '__main__':
    main()

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')
            exit()
print('NO')

Submission status: Accepted

Solution code:
S = input()
ls = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
is_ng = True
idx = 0
tmp = 0
for i in range(len(ls)):
    l = S[:i]
    r = S[-len(ls)+i:]
    if l+r == 'keyence':
        is_ng=False

print('YNEOS'[is_ng::2])

Submission status: Accepted

Solution code:
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")
            quit()
print("NO")

Submission status: Accepted

Solution code:
S = input()

V = "keyence"
t = len(S) - len(V)

for i in range(len(S) - t + 1):
    if S[:i] + S[i+t:] == V:
        print("YES")
        exit(0)
print("NO")

Submission status: Accepted

Solution code:
def main():
    s = input().rstrip()
    f = False
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[:j]+s[j+i:] == "keyence":
                f = True
    if f:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    s = 'keyence'
    for i in range(len(s)+1):
        if S.startswith(s[:i]) and S.endswith(s[i:]): return True
    return False

if __name__ == '__main__':
    print('YES' if main() else 'NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    s = 'keyence'
    for i in range(len(s)+1):
        judge = True
        for j in range(i):
            if s[j] != S[j]:
                judge = False
                break
        for j in range(len(s)-i):
            if s[-1-j] != S[-1-j]:
                judge = False
                break
        if judge:
            return True
    return False

if __name__ == '__main__':
    print('YES' if main() else 'NO')

Submission status: Accepted

Solution code:
S = input()
key = "keyence"
ans = "NO"
for i in range(8):
    left = key[0:i]
    right = key[i:8]
    if S[0:i] == left and S[len(S)-7+i:len(S)] == right:
        ans = "YES"
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from math import sqrt
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from itertools import accumulate,permutations
from bisect import bisect_left,bisect_right

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()
target = 'keyence'
if target in S:
    print('YES')
    exit()
l = 0
r = 0
while S[l] == target[l]:
    l += 1
while S[len(S)-r-1] == target[6-r]:
    r += 1
if l + r >= 7:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S = list(input())[: -1]
for l in range(len(S)):
  for r in range(l, len(S)):
    t = S[: l] + S[r: ]
    if "".join(t) == "keyence":
      print("YES")
      exit(0)
print("NO")

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
l = len(s)
a = 'keyence'
flag = False
for i in range(l - 6): #消し始め
    for j in range(l - i + 1): #消す文字数
        if s[:j] + s[i+j:] == a:
            print('YES')
            exit()
print('NO')

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    for i in range(N):
        for j in range(N+1):
            T = S[:i] + S[i+j:]  # S[i:i+j]を取り除く
            if T == "keyence":
                return print("YES")
    print("NO")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# KEYENCE String 全通りのパターンを探索する

# input process
S = input()
s_length = len(S)

# initialization
is_same = False
for i in range(s_length):
    for j in range(i, s_length):
        # string slice
        tmp_str = S[:i+1] + S[j:]
        if tmp_str=="keyence":
            is_same = True
            break

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
k = "keyence"
nk =len(k)

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

Submission status: Accepted

Solution code:
s = str(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()
flag = 1
for i in range(100):
        for j in range(100):
                if s[:j] + s[j+i:]=="keyence":
                        flag = 0
print("YNEOS"[flag::2])

Submission status: Accepted

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

if len(s) < len(t):
    print('NO')
    exit()

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

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

for i in range(len(t)):
    if s[0:i+1] == t[0:i+1] and s[len(s)-len(t)+(i+1):len(s)] == t[(i+1):len(t)]:
        print('YES')
        exit()
else:
    print('NO')

Submission status: Accepted

Solution code:
s = input()
target = 'keyence'
l = len(s)
for i in range(l - 6): #消す文字数 
    #print(i)
    for j in range(l - i + 1): #消し始めの位置
        a = s[:j] + s[j+i:]
        #print(i, j, a)
        if a == target:
            print('YES')
            exit()
print('NO')

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    ans = "keyence"
    for i in range(N):
        for j in range(N+1):
            T = S[:i] + S[i+j:]  # S[i:i+j]を取り除く
            if T == ans:
                return print("YES")

    print("NO")


if __name__ == '__main__':
    main()