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: Wrong Answer

Solution code:
s=input()
keyence = 'keyence'
l,r = '',''
for i in range(7):
    if s[i]==keyence[i]:    l += s[i]
    else:   break
for i in range(1,8):
    #print(s[-i],keyence[-i])
    if s[-i]==keyence[-i]:    r += s[-i]
    else:   break
if l+r[::-1] == keyence or l == keyence or r[::-1] == keyence:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

Solution code:
s=input()
a=["k","e","y","e","n","c","e"]
l=len(s)
n=0
while n<l:
    key=0
    flag=0
    for i in range(l):
        if n<=i:
            if flag==0 and a[key]==s[i]:
                key+=1
                if key==0:
                    n=i
                if key==6:
                    print("YES")
                    exit()
            elif flag==0 and key==0:
                pass
            elif flag==0:
                flag=1
            elif flag==1 and a[key]==s[i]:
                key+=1
                flag=2
                if key==6:
                    print("YES")
                    exit()
            elif flag==1:
                pass
            elif flag==2 and a[key]==s[i]:
                key+=1
                if key==6:
                    print("YES")
                    exit()
            else:
                break
    n+=1
print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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' in s:
            flag = True

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

Submission status: Wrong Answer

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):].rfind(w_b) == len(w_b) + 1:
            print("YES")
            exit(0)
    else:
        print("NO")

Submission status: Wrong Answer

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 w_b in s[len(w_a):]:
            print("YES")
            exit(0)
    else:
        print("NO")

Submission status: Wrong Answer

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 w_b in s:
            print("YES")
            exit(0)
    else:
        print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
if s == "keyence" + s[7:] or s == s[:-7] + "keyence":
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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: Wrong Answer

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


isKeyence = False
for start in range(99):
    i = start
    stack = 0
    p = 0
    while i < len(S):
        s = S[i]
        if s == KEYENCE[p]:
            p += 1
            if p == len(KEYENCE):
                isKeyence = True
                break
        else:
            if i > 0 and S[i-1] == KEYENCE[p-1]:
                stack += 1
                if stack > 1:
                    stack = 0
                    p = 0
                    i -= 1
        i += 1
if isKeyence:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
p = 0
KEYENCE = "keyence"
stack = 0

isKeyence = False
i = 0
while i < len(S):
    s = S[i]
    if s == KEYENCE[p]:
        p += 1
        if p == len(KEYENCE):
            isKeyence = True
            break
    else:
        if i > 0 and S[i-1] == KEYENCE[p-1]:
            stack += 1
            if stack > 1:
                stack = 0
                p = 0
                i -= 1
    i += 1
if isKeyence:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
p = 0
KEYENCE = "keyence"
stack = 0

isKeyence = False
for i in range(len(S)):
    s = S[i]
    if s == KEYENCE[p]:
        p += 1
        if p == len(KEYENCE):
            isKeyence = True
            break
    else:
        if i > 0 and S[i-1] == KEYENCE[p-1]:
            stack += 1
            if stack > 1:
                stack = 0
                p = 0
if isKeyence:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
p = 0
KEYENCE = "keyence"
stack = 0

isKeyence = False
for i in range(len(S)):
    s = S[i]
    if s == KEYENCE[p]:
        p += 1
        if p == len(KEYENCE):
            isKeyence = True
            break
    else:
        if i > 0 and S[i-1] == KEYENCE[p-1]:
            stack += 1
            if stack > 2:
                stack = 0
                p = 0
if isKeyence:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

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):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re

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

Submission status: Wrong Answer

Solution code:
import re

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

Submission status: Wrong Answer

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

S = list(input().strip())
t = list("keyence")
    
for i in range(1, 8):
    a, b = t[0:i], t[i:]
    
    f = True
    for j in range(len(S)):
        if f:
            if S[j:i+j] == a:
                f = False
        
        if f == False:
            if S[i+j:] == b:
                print("YES")
                exit()
                
print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re

def solve(S):
    patterns = ['^.*keyence$', '^k.*eyence$', '^ke.*yence$', '^key.*ence$',
                '^keye.*nce$', '^keyen.*ce$', '^keyenc.*e$', '^keyence.*$']
    for p in patterns:
        if re.match(p, S):
            return 'YES'
    return 'NO'

Submission status: Wrong Answer

Solution code:
S=input()
flag=0
if S.count("k") > 0:
    if S[S.index("k")+1:].count("eyence") > 0:
        flag=1
if S.count("ke") > 0:
    if S[S.index("ke")+2:].count("yence") > 0:
        flag=1
if S.count("key") > 0:
    if S[S.index("key")+3:].count("ence") > 0:
        flag=1
if S.count("keye") > 0:
    if S[S.index("keye")+4:].count("nce") > 0:
        flag=1
if S.count("keyen") > 0:
    if S[S.index("keyen")+5:].count("ce") > 0:
        flag=1
if S.count("keyenc") > 0:
    if S[S.index("keyenc")+6:].count("e") > 0:
        flag=1
if flag==1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

Solution code:
S = input()

import re
s = "keyence"
ans = s in S
for i in range(1, len(s)):
    s1 = s[:i]
    s2 = s[i:]
    ans = ans or re.match(".*{}.*{}".format(s1, s2), S)

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

Submission status: Wrong Answer

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-6:] == "ce":
    flag = 1
elif S[:2] == "keyenc" and S[n-6:] == "e":
    flag = 1
if flag:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
flag=1
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: Wrong Answer

Solution code:
s=input()
pos=0
cnt=0
flag=True
check='keyence?'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and cnt<=1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s=input()
pos=0
cnt=0
flag=True
check='keyence'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
    if pos==7:
      break
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and cnt<=1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

if any([0 <= S.find(k[:i]) < S.rfind(k[i:]) for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

for i in range(l):
    print(i, k[:i], k[i:], S.find(k[:i]), S.rfind(k[i:]))

if any([0 <= S.find(k[:i]) < S.rfind(k[i:]) for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

#for i in range(l):
#    print(i, S.find(k[:i]), S.find(k[i:]))

if any([0 <= S.find(k[:i]) < S.find(k[i:]) for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

if any([0 < S.count(k[:i]) < S.count(k[i:]) for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

if any([S.count(k[:i]) > 0 and S.count(k[i:]) > 0 for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
k = "keyence"
l = len(k)

S = input()

if any([S.count(k[:i]) > 0 and S.count(k[i+1:]) > 0 for i in range(l)]):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  if len(m)==0:
    if n in s:
      ans=0
    else:
      continue
  m=s.find(m)
  n=s.rfind(n)
  if m==-1 or n==-1:
    continue
  if n>m:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Wrong Answer

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  i=len(m)
  m=s.find(m)
  n=s.rfind(n)
  if m==-1 or n==-1:
    continue
  if n>m:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Wrong Answer

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  i=len(m)
  m=s.find(m)
  n=s.rfind(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Wrong Answer

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.rfind(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Wrong Answer

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.find(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
import re
s = input()
matches = []
matches.append(re.compile(r'\w*?keyence').search(s))
matches.append(re.compile(r'k\w*?eyence').search(s))
matches.append(re.compile(r'ke\w*?yence').search(s))
matches.append(re.compile(r'key\w*?ence').search(s))
matches.append(re.compile(r'keye\w*?nce').search(s))
matches.append(re.compile(r'keyen\w*?ce').search(s))
matches.append(re.compile(r'keyenc\w*?e').search(s))
matches.append(re.compile(r'keyence\w*?').search(s))

if matches.count(None) != len(matches):
	print('YES')
else:
	print('NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
matches = []
matches.append(re.compile(r'\w*keyence').search(s))
matches.append(re.compile(r'k\w*eyence').search(s))
matches.append(re.compile(r'ke\w*yence').search(s))
matches.append(re.compile(r'key\w*ence').search(s))
matches.append(re.compile(r'keye\w*nce').search(s))
matches.append(re.compile(r'keyen\w*ce').search(s))
matches.append(re.compile(r'keyenc\w*e').search(s))
matches.append(re.compile(r'keyence\w*').search(s))

if matches.count(None) != len(matches):
	print('YES')
else:
	print('NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
matches = []
matches.append(re.compile(r'\w+keyence').search(s))
matches.append(re.compile(r'k\w+eyence').search(s))
matches.append(re.compile(r'ke\w+yence').search(s))
matches.append(re.compile(r'key\w+ence').search(s))
matches.append(re.compile(r'keye\w+nce').search(s))
matches.append(re.compile(r'keyen\w+ce').search(s))
matches.append(re.compile(r'keyenc\w+e').search(s))
matches.append(re.compile(r'keyence\w+').search(s))

if matches.count(None) != len(matches):
	print('YES')
else:
	print('NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
match = re.compile(r'(\w*?k\w*?e\w*?y\w*?e\w*?n\w*?c\w*?e\w*?)').search(s)
if match != None:
	print('YES')
else:
	print('NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
match = re.compile(r'(\w*k\w*e\w*y\w*e\w*n\w*c\w*e\w*)').search(s)
if match != None:
	print('YES')
else:
	print('NO')

Submission status: Wrong Answer

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

#B
s = S()
n = len(s)
if s == list("keyence"):
    print("YES")
    quit()
for i in range(n):
    for j in range(i+1,n):
        print(s[:i]+s[j:])
        if s[:i]+s[j:] == list("keyence"):
            print("YES")
            quit()
print("NO")
#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

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()
    elif i==len(A):
      print("NO")
      exit()
    else:
      continue

Submission status: Wrong Answer

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)]
    print(b)
    if b == "keyence":
      print("YES")
      exit()
    elif i==len(A):
      print("NO")
      exit()
    else:
      continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l="keyence"
i=input()
if l in i:
    if i.find(l)==0 or i.find(l)==-7:
        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:
            print("YES")
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
l="keyence"
i=input()
if l in i:
    if i.find(l)==0 or i.find(l)==-7:
        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:]):
            print("YES")
            exit()
print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l="keyence"
r=0
for s in input():
    if l[r]==s:
        r+=1
    if r==7:
        print("YES")
        exit()
print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = "NO"

keyword = "keyence"
for i in range(len(keyword)):
    if keyword[:i] in s and keyword[i:] in s:
        s_replaced = s.replace(keyword[:i], "*", 1).replace(keyword[i:], "*", -1)
        splited = s_replaced.split("*")
        while "" in splited:
            splited.remove("")
        if len(splited) <= 1:
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = "NO"

keyword = "keyence"
for i in range(1, len(keyword)):
    if keyword[:i] in s and keyword[i:] in s:
        s_replaced = s.replace(keyword[:i], "*", 1).replace(keyword[i:], "*", -1)
        splited = s_replaced.split("*")
        while "" in splited:
            splited.remove("")
        if len(splited) <= 1:
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = "NO"

keyword = "keyence"
for i in range(1, len(keyword)):
    if keyword[:i] in s and keyword[i:] in s:
        s_replaced = s.replace(keyword[:i], "*", 1).replace(keyword[i:], "*", 1)
        splited = s_replaced.split("*")
        while "" in splited:
            splited.remove("")
        if len(splited) <= 1:
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = "NO"

keyword = "keyence"
for i in range(1, len(keyword)):
    if keyword[:i] in s and keyword[i:] in s:
        s_replaced = s.replace(keyword[:i], "*").replace(keyword[i:], "*")
        splited = s_replaced.split("*")
        while "" in splited:
            splited.remove("")
        if len(splited) <= 1:
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
import re

s = input()
ans = "NO"

keyword = "keyence"
for i in range(1, len(keyword)):
    if keyword[:i] in s and keyword[i:] in s:
        s_replaced = s.replace(keyword[:i], "*").replace(keyword[i:], "*")
        splited = s_replaced.split("*")
        while "" in splited:
            splited.remove("")
        print(splited)
        if len(splited) <= 1:
            ans = "YES"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
if set(s)>=set(k):
  for t in range(1,len(k)):
    if k[:t]in s and k[t:]in s:
      print("YES")
      exit()
else:
  print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if keyence in S:
  print("YES")
else:
  for i in range(len(keyence)):
    if keyence[0:i] in S:
      S.lstrip(keyence[0:i])
      if keyence[i:8] in S:
        print("YES")
        break
  else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import copy
key = list(input())
hantei=0
length=len(key)
for i in range(length):
    if hantei==1:
        break
    a=copy.deepcopy(key)
    if i==length-1:
        j=length-2
    else:
        j=i
    while j<length-1:
        del a[i]
        j+=1
        if "".join(a)=="keyence":
            hantei=1
            break
if hantei==1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re
chars = input()
ptns = {'[a-x]*(keyence)+','(k)+[a-x]*(eyence)+','(ke)+[a-x]*(yence)+','(key)+[a-x]*(ence)+','(keye)+[a-x]*(nce)+','(keyen)+[a-x]*(ce)+','(keyenc)+[a-x]*(e)+','(keyence)+[a-x]*'}
cnt = 0
for ptn in ptns:
  isPTN = re.match(ptn, chars) != None;
  if isPTN == True:
    print("YES")
    break
  cnt = cnt + 1
if cnt == 8:
	print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

s = input()
a = ["k", "ke", "key", "keye", "keyen", "keyenc"]
b = ["eyence", "yence", "ence", "nce", "ce", "e"]
if s == "keyence":
    print("YES")
    exit(0)
if len(s) > 7:
    if s[7:] == "keyence":
        print("YES")
        exit(0)
    if s[:7] == "keyence":
        print("YES")
        exit(0)
    else:
        for i in range(6):
            if a[i] in s and b[i] in s:
                if s.find(a[i])==0 and s.rfind(b[i])+len(b[i])==len(s):
                    print("YES")
                    exit(0)
                else:
                    print("NO")
                    exit(0)
            else:
                print("NO")
                exit(0)

Submission status: Wrong Answer

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
target = 'keyence'

for i in range(1, len(target)):
    if target[:i] in S and target[i:] in S:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
k,n,c = "keyence",len(s),0
for i in range(8):
	if k[:i]==s[:i] and k[i:]==s[n+i-8:]: break
	else: c+=1
if c-8: print("NO")
else: print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
result = 'NO'
k = 'keyence'
for i in range(0, len(k)):
	k1 = k[:i]
	p1 = s.find(k1)
	if p1 != -1:
		if i == len(k)-1:
			result = 'YES'
			break
		else:
			k2 = k[i:]
			if s[len(s)-len(k2):] == k2:
				result = 'YES'
				break
print(result)

Submission status: Wrong Answer

Solution code:
s = input()
result = 'NO'
k = 'keyence'
for i in range(0, len(k)):
	k1 = k[:i]
	p1 = s.find(k1)
	if p1 != -1:
		if i == len(k):
			result = 'YES'
			break
		else:
			k2 = k[i:]
			if s[len(s)-len(k2):] == k2:
				result = 'YES'
				break
print(result)

Submission status: Wrong Answer

Solution code:
s = input()
result = 'NO'
k = 'keyence'
for i in range(1, len(k)):
	k1 = k[:i]
	p1 = s.find(k1)
	if p1 != -1:
		if i == len(k):
			result = 'YES'
			break
		else:
			k2 = k[i:]
			if s[len(s)-len(k2):] == k2:
				result = 'YES'
				break
print(result)

Submission status: Wrong Answer

Solution code:
s = input()
result = 'NO'
k = 'keyence'
for i in range(1, len(k)):
	k1 = k[:i]
	p1 = s.find(k1)
	if p1 != -1:
		k2 = k[i:]
		p2 = s.find(k2, p1 + 1)
		if p2 != -1:
			result = 'YES'
			break
print(result)

Submission status: Wrong Answer

Solution code:
S = input()
length = len(S)
found = False
for i in range(length):
    for j in range(i, length):
        if S[:i] + S[-j:] == 'keyence':
            found = True
            break
    if found:
        break

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

Submission status: Wrong Answer

Solution code:
stringEnter = input()
target = "keyence"
counter = 0
targetCounter = 0
while(counter < len(stringEnter) and targetCounter < len(target)):
 if(stringEnter[counter] == target[targetCounter]):
  targetCounter += 1
 counter += 1
if(targetCounter == len(target)):
 print("YES");
else:
 print("NO");

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in range(7):
  if 'keyence'[:i] in s and 'keyence'[i:] in s:
    if 'keyence'.index('keyence'[:i]) >= 'keyence'.index('keyence'[i:]):
      c += 1
      break
if c >= 1 :
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in range(7):
  if 'keyence'[:i] in s and 'keyence'[i:] in s:
    if 'keyence'.index('keyence'[:i]) <= 'keyence'.index('keyence'[i:]):
      c += 1
      break
if c >= 1 :
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in range(7):
  if 'keyence'[:i] in s and 'keyence'[i:] in s:
    c += 1
    break
if c >= 1 :
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
if len(s.split('keyence')) == 2:
  print('YES')
else:
  print('NO')