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:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s=input()
k='keyence'
for i in range(8):
    if k[:i] == s[:i]:
        if k[-7+i:]==s[-7+i:] or i==7:
            print('YES')
            exit()
print('NO')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

k = 'keyence'

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

print('NO')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n = len(S) - len(T)

j = 0
for i in range(7):
    if T[i] == S[i]:
        continue
    else:
        j = i
        break

print('YES' if T == S[:j]+S[j+n:] else 'NO')

Submission status: Accepted

Solution code:
import re
S = input()
k = 'keyence'
for i in range(0, len(k)+1):
    rs = '^' + k[:i] + '.*' + k[i:] + '$'
    if re.match(rs, S) is not None:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = input()
_S = 'keyence'
_N = len(_S)
for i in range(_N + 1):
    if _S[:i] == S[:i] and _S[i:] == S[len(S) - _N + i:]:
        print('YES')
        sys.exit()
print('NO')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = list(input())
k = ["k", "e", "y", "e", "n", "c", "e"]
ans = []
i = 0
while s[i] == k[i]:
    ans.append(s[i])
    i += 1
    if i == 7:
        break
for j in range(len(s) - 7 + i, len(s)):
    ans.append(s[j])

jud = True
for j in range(7):
    if ans[j] != k[j]:
        jud = False
if jud:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]


def solve():
    s = input()
    t = 'keyence'
    n = len(s)
    
    for i in range(n):
        for j in range(n - i):
            x = (s[:i] + s[i+j:])
            if x == t:
                print("YES")
                return



    print("NO")


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()

"""

"""

Submission status: Accepted

Solution code:
import re
s = input()
y = "YES"
n = "NO"
if s == "keyence":
    print(y)
elif re.fullmatch(r'[a-z]+keyence',s) != None:
    print(y)
elif re.fullmatch(r'k[a-z]+eyence',s) != None:
    print(y)
elif re.fullmatch(r'ke[a-z]+yence',s) != None:
    print(y)
elif re.fullmatch(r'key[a-z]+ence',s) != None:
    print(y)
elif re.fullmatch(r'keye[a-z]+nce',s) != None:
    print(y)
elif re.fullmatch(r'keyen[a-z]+ce',s) != None:
    print(y)
elif re.fullmatch(r'keyenc[a-z]+e',s) != None:
    print(y)
elif re.fullmatch(r'keyence[a-z]+',s) != None:
    print(y)
else:
    print(n)

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

print("NO")

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    n = len(S)
    c = 0
    if S == 'keyence':
        print('YES')
        exit()
    for i in range(n):
        for j in range(i, n):
            s1 = S[:i] if i > 0 else ''
            s2 = S[j + 1:] if j + 1 < n else ''
            if s1 + s2 == 'keyence':
                print('YES')
                exit()
    print('NO')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

s = input()

l = len(s)-7


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

print("YES")

Submission status: Accepted

Solution code:
s = input()

k = 'keyence'

ok = False
for i in range(8):
    if s[0:i] == k[0:i] and s[-7+i:] == k[-7+i:]:
        ok = True
        break

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

Submission status: Accepted

Solution code:
S = input()

s = S.replace('keyence', '0')
lst = []
k = 'keyence'
jdg = False

if s[0] == '0' or s[-1] == '0':
    jdg = True
elif '0' in s:
    jdg = False
else:
    for i in range(1, len(k)):
        lst.append([k[:i], k[i:]])

    for i, j in enumerate(lst, start=1):
        if s[:i] == j[0] and s[i-7:] == j[1]:
            jdg = True
            break
if jdg: print('YES')
else: print('NO')

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
s = input()
# s = 'keyxxxxxxxxxxence'
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

K = 'keyence'

for i in range(len(s)):
    for j in range(len(s)):
        s1 = s[0:i]
        s2 = s[i:i + j]
        s3 = s[i + j:]

        # print(s1,s2,s3)
        if s1 == K or s2 == K or s3 == K or s1 + s2 == K or s1 + s3 == K or s2 + s3 == K:
            print('YES')
            exit()

print('NO')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

S = input()

for i in range(len(S)):
    for j in range(i,len(S)):
        t = S[0:i]+S[j:]
        if t == "keyence":
            print("YES")
            sys.exit()

print("NO")

Submission status: Accepted

Solution code:
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=SI()
for i in range(len(s)):
    for j in range(i,len(s)+1):
        s1=s[:i]
        s2=s[j:]
        if s1+s2=="keyence":
            print("YES")
            sys.exit()
print("NO")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
S = input()
nya = 'keyence'
ln = len(nya)
for i in range(ln+1):
    #print('-',S[:i],S[len(S)-ln+i:])
    #print('--',nya[:i],nya[i:])
    if S[:i] == nya[:i] and S[len(S)-ln+i:] == nya[i:]:
        print('YES')
        exit()

print('NO')

Submission status: Accepted

Solution code:
s = input()
ans = "NO"
if s[:7]== "keyence" or s[:-7] == "keyence":
    ans = "YES"
else:
    a = "keyence"
    for i in range(7):
        if s[:i]+s[-7+i:] == a: ans = "YES"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

S = ins()
K = "keyence"


def solve():
    if len(S) < len(K):
        return False
    f = b = True
    x = y = 0
    ns = len(S)
    nk = len(K)
    for i in range(len(S)):
        if i < nk and S[i] == K[i]:
            if f:
                x += 1
        else:
            f = False
        if nk - 1 - i >= 0 and S[ns - 1 - i] == K[nk - 1 - i]:
            if b:
                y += 1
        else:
            b = False
    # debug(f"{x=} {y=}")
    return x + y >= nk


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
k = "keyence"
n = len(S)-7

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

Submission status: Accepted

Solution code:
S = input();
str = 'keyence';
ans = 'NO'
if S[:7] == str :
    ans = 'YES';
elif S[-7:] == str :
    ans = 'YES';
else :
    for i in range(1,8) :
        if S[0:i] == str[0:i] and S[-7+i:] == str[-7+i:] :
            ans = 'YES';
            break;

print(ans);

Submission status: Accepted

Solution code:
s=input()
key="keyence"
li=[]
for i in range(len(key)):
  li.append([key[:i],key[i:]])
  
for i in li:
  #print("{} {}".format(s[:len(i[0])],s[-len(i[1]):]))
  if s[:len(i[0])]==i[0] and s[-len(i[1]):]==i[1]:
    print("YES")
    break
else:
  print("NO")

Submission status: Accepted

Solution code:

KEY = "keyence"

def main():
    s = input()

    if s.startswith(KEY) or s.endswith(KEY):
        print("YES")
        return

    for i in range(1, len(KEY)):
        st = KEY[0:i]
        ed = KEY[i:]

        if s.startswith(st) and s.endswith(ed):
            print("YES")
            return

    print("NO")

main()

Submission status: Accepted

Solution code:
import re
s = input()
pattern={
    '.*keyence'
    ,'k.*eyence'
    ,'ke.*yence'
    ,'key.*ence'
    ,'keye.*nce'
    ,'keyen.*ce'
    ,'keyenc.*e'
    ,'keyence.*'
    }

for p in pattern:
    if re.fullmatch(p, s):
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
import sys

S = input()
num = len(S)

for i in range(num):
    if S[:i] + S[num-7+i:] == 'keyence':
        print('YES')
        sys.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")
			exit()
print("NO")

Submission status: Accepted

Solution code:
S = input()

def range_strip(S, i, j):
    return S[:i] + S[j:]

for i in range(len(S)):
    for j in range(i, len(S)):
        if range_strip(S,i,j) == "keyence":
            print("YES")
            exit(0)
print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

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

elif S[:1] + S[-6:] == "keyence" or S[:2] + S[-5:] == "keyence" or S[:3] + S[-4:] == "keyence" or S[:4] + S[-3:] == "keyence" or S[:5] + S[-2:] == "keyence" or S[:6] + S[-1:] == "keyence":
    print("YES")
    exit()

else:
    print("NO")

Submission status: Accepted

Solution code:
S=input()
l = len(S)
#keyencexxxxx
if S[:7]=="keyence":
  print("YES")
#kxxxxxeyence
elif S[:1]=="k" and S[l-6:]=="eyence":
  print("YES")
#kexxxxxyence
elif S[:2]=="ke" and S[l-5:]=="yence":
  print("YES")
#keyxxxxxence
elif S[:3]=="key" and S[l-4:]=="ence":
  print("YES")
#keyexxxxxnce
elif S[:4]=="keye" and S[l-3:]=="nce":
  print("YES")
#keyenxxxxxce
elif S[:5]=="keyen" and S[l-2:]=="ce":
  print("YES")
#keyencxxxxxe
elif S[:6]=="keyenc" and S[l-1:]=="e":
  print("YES")
#xxxxxkeyence
elif S[l-7:]=="keyence":
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
s = input()

n = len(s)

ans = False
for i in range(n):
    for j in range(i, n):
        if s[:i] + s[j:] == "keyence":
            ans = True

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

Submission status: Accepted

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

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

print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = input()
	key = 'keyence'
	for i in range(len(key)+1):
		if -len(key)+i < 0:
			ts=s[:i]+s[-len(key)+i:]
		else:
			ts = s[:i]
		pa(ts)
		if ts == key:
			return 'YES'
	return 'NO'
			
	
	
#+++++
isTest=False
def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
def main():
    S = input()
    is_keyence = False
    string = "keyence"

    for i in range(len(string)):
        if S.startswith(string[:i]) and S.endswith(string[i:]):
            is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
instring = input()
head_str = ""
foot_str = ""
ans_str = ""
ref = "keyence"
ref_rev = ref[::-1]
flag = False

# 頭からあっているかチェックしていく
start_index = 0
end_index = len(ref)-1
# 前から数えていく
for i in range(len(instring)):
    head_str += instring[i]
    now_ref = ref[:(i+1)]
    # 前から並べたときに一致しているかチェック
    if(head_str != now_ref):
        # どこで一致しなくなったかメモ
        start_index = i
        flag = True
        break

# normal
if(flag):
    ans_str += head_str[:start_index]
else:
    ans_str = head_str

end_flag = False
# 既に一致していたらこれ以上やらない
if(ans_str == ref):
    print("YES")
    end_flag = True

ans_len = len(ans_str)    

# 後ろから数えていく
for i in range(len(ref)-ans_len):        
    foot_str += instring[-(i+1)]
    now_ref = ref_rev[:(i+1)]
    if (foot_str != now_ref):
        end_index = i
        break

# 反転させる
foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

if(end_flag != True):
    if(ans_str == ref):
        print("YES")
    else:
        print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
# Q2
S=str(input())
#print(S)

K='keyence'
#print(len('keyence'))
ans=0

'''
print('first=',S[0:6])
print('last=',S[len(S)-7:])
if S[0:7]==K:
    ans=1
if S[len(S)-7:]==K:
    ans=1
'''

for i in range(7+1):
#    print(S[0:i]+S[len(S)-7+i:])
    if S[0:i]+S[len(S)-7+i:]==K:
        ans=1

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

Submission status: Accepted

Solution code:
S = str(input())

flg = False

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

Submission status: Accepted

Solution code:
s = input()
ans_flag = False
if "keyence" in s:
  ans_flag = True
  
t = "keyence"
for i in range(1,7):
  first_half = t[:i]
  second_half = t[i:]
  if first_half == s[:len(first_half)]:
    if s[-len(second_half):] == second_half:
      ans_flag = True

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

Submission status: Accepted

Solution code:
S = input()
flag = False
if S.count('keyence') > 0:
    flag = True
else:
    key = 'keyence'
    i = 0
    while key[i] == S[i]:
        i += 1
    if key[i:] == S[-(7-i):]:
        flag = True
print('YES' if flag else 'NO')

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

S = input()
N = len(S)

for l in range(N):
	for r in range(l, N):
		if S[:l] + S[r:] == "keyence":
			print("YES")
			break
	else:
		continue
	break
else:
	print("NO")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

S = input()

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

for i, j in combinations(list(range(len(S))), 2):
	if S[:i] + S[j:] == "keyence":
		print("YES")
		break
else:
	print("NO")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print("NO")

Submission status: Accepted

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

print("NO")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
w = "keyence"
for i in range(7):
  if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
    print("YES")
    break
  elif i == 6:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    N = len(S)
    w = "keyence"
    for i in range(7):
        if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
            print("YES")
            break
    else: print("NO")

    return 0

if __name__ == "__main__":
    solve()