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()

key1=s.find('k')
flag=0
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('e')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('y')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('e')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('n')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]
    
key1=s.find('c')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key2=s.count('e')
if key2==-1:
    flag=1
    
if flag==1:
  print('NO')
else:
  print('YES')

Submission status: Wrong Answer

Solution code:
S=list(input())
if "k" and "e" and "y" and "e" and "n" and "c" and "e" in S:
    if S[-1]=="e" and S[-2]=="c" and S[-3]=="n" and S[-4]=="e" and S[-5]=="y" and S[-6]=="e" and S[-7]=="k":
        print("Yes")
    else:
        if S[0]=="k":
            if S[1]=="e":
                if S[2]=="y":
                    if S[3]=="e":
                        if S[4]=="n":
                            if S[5]=="c":
                                if S[6]=="e":
                                    print("YES")
                                else:
                                    if S[-1]=="e":
                                        print("YES")
                                    else:
                                        print("No")
                            else:
                                if S[-1]=="e" and S[-2]=="c":
                                    print("YES")
                                else:
                                    print("No")
                        else:
                            if S[-1]=="e" and S[-2]=="c" and S[-3]=="n":
                                print("YES")
                            else:
                                print("NO")
                    else:
                        if S[-1]=="e" and S[-2]=="c" and S[-3]=="n" and S[-4]=="e":
                            print("YES")
                        else:
                            print("NO")
                else:
                    if S[-1]=="e" and S[-2]=="c" and S[-3]=="n" and S[-4]=="e" and S[-5]=="y":
                        print("YES")
                    else:
                        print("NO")
            else:
                if S[-1]=="e" and S[-2]=="c" and S[-3]=="n" and S[-4]=="e" and S[-5]=="y" and S[-6]=="e":
                    print("YES")
                else:
                    print("NO")
        else:
            print("NO")
else:
    print("NO")

Submission status: Wrong Answer

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

for i in range(len(S)):
    if S[i] == 'k':
        for l in range(1, len(s)):
            if S[i+l] != s[l]:
                break
        for n in range(len(S)):
            if S[i:l] + S[l+n:l+n+4] == s and S[l+n+5:] == '':
                if i != 0 and n == 0 or i == 0 and n != 0:
                    print(i)
                    ans = 'YES'
                    break
    if ans == 'YES':
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())

while True:
    if s[0] == "k":
        break
    elif len(s) > 7:
        s = s[1:]
    else:
        print("NO")
        exit()
if len(s) < 7:
    print("NO")
else:
    middlerange = len(s) - 7
    if s[0]+s[middlerange+1:] == "keyence":
        print("YES")
    elif s[0:2]+s[middlerange+2:] == "keyence":
        print("YES")
    elif s[0:3]+s[middlerange+3:] == "keyence":
        print("YES")
    elif s[0:4]+s[middlerange+4:] == "keyence":
        print("YES")
    elif s[0:5]+s[middlerange+5:] == "keyence":
        print("YES")
    elif s[0:6]+s[middlerange+6:] == "keyence":
        print("YES")
    elif s[0:7]+s[middlerange+7:] == "keyence":
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
ans='keyence'
i=0 # index of s
index=0 # index of ans
isCut=0
canRestart=0
restart=0
lenS=len(s)
while i<lenS:
    if isCut==1: # 切られたあと
        if index>6: # 7=len(ans)
            if canRestart:
                canRestart=0
                i=restartI+1
                index=restartIndex
            else:
                break
        if s[i]==ans[index]:
            index+=1
        else:
            if canRestart:
                canRestart=0
                isCut=-1
                i=restartI+1
                index=restartIndex
            else:
                break
    elif isCut==-1: # 切られている途中
        if s[i]==ans[index]:
            # 切り方を変えるときはiとindexを戻す
            restartIndex=index
            restartI=i
            canRestart=1
            isCut=1
            index+=1
    else: # 切られる前
        if s[i]==ans[index]:
            index+=1
        else:
            isCut=-1
    # print(i,index,isCut)
    i+=1

if index<=6: # 7=len(ans)
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
n = list(map(str,input()))

flg = 0

if ''.join(n) == 'keyence':
    print('Yes')
    flg = 1
else:
    for i in range(8):
        arr = list(''.join(n)) 
        del arr[i:i+len(n)-7]
        tmp = ''.join(arr)
        if tmp == 'keyence':
            print('YES')
            flg = 1
            break

if flg == 0:
    print('NO')

Submission status: Wrong Answer

Solution code:
#coding:utf-8

STRNUM = 8

def concat(str_list):
    s = ""
    for i in str_list:
        s += i
    return s

in_s = input()
l = len(in_s)
is_key = False
if(l >= 7)|(l <= 100):
    keyence = list("keyence")
    if "keyence" in in_s:
        splt_res = in_s.split("keyence")
        if(splt_res[0]=="")|(splt_res[1]==""):
            is_key = True
    else:
        for i in range(STRNUM-1):
            str1 = concat(keyence[0:i+1])
            str2 = concat(keyence[i+1:])
            # str1 で分割
            if str1 in in_s:
                splt_res = in_s.split(str1)
                if splt_res[0] == "":
                    if str2 in splt_res[1]:
                        splt_res2 = splt_res[1].split(str2)
                        if(splt_res2[0]=="")|(splt_res2[1]==""):
                            is_key = True

if is_key == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

if S == 'keyence': print('YES')
elif len(S) == 7: print('NO')
else:
	for length in range(len(S)-7):
		for i in range(len(S)-length):
			print(S[0:i] + S[i+length+1:])
			if S[0:i] + S[i+length+1:] == 'keyence':
				print('YES')
				exit(0)
	print('NO')

Submission status: Wrong Answer

Solution code:
import sys
s = list(input())
time = 0
i = 0
n = 0
start = -1
end = -1
for i in range(7):
    if s[i+n] != "keyence"[i]:
        start = i
        while i+n < len(s) and "keyence"[i] != s[i+n]:
            n += 1
        else:
            end = i+n
            break
if start != -1 and end != -1:
    del s[start:end]
    if s == list("keyence"):
        print("YES")
    else:
        print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
a = str(input())
k = "keyence"
lk = len(k)

ok = 0

if len(a) >= lk:
    s1 = a.find(k)
    s2 = len(a[s1:])
    if s1 == 0 or s2 == lk:
        ok = 1

    for i in range(lk):
        s1 = a.find(k[:i])
        s2 = a[s1+i:].find(k[i:])
        if s1 >= 0 and s2 >= 0:
            if s1 == 0 and len(a[s1+i+s2:]) == len(k[i:]):
                ok = 1

if ok == 1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import sys, re

P = r'(.*)k(.*)e(.*)y(.*)e(.*)n(.*)c(.*)e(.*)'

s = input().rstrip('\n')

m = re.match(P, s)

if m is not None:
  if len([ x for x in m.groups() if x]) <= 1:
    print('YES')
    sys.exit()
print('NO')

Submission status: Wrong Answer

Solution code:
# coding: utf-8

cnt=0
keyence="keyence"
flg=[-1,-1,-1,-1,-1,-1,-1]
s=input()

for i in range(len(s)):
    for j in range(len(keyence)):
        if s[i]==keyence[j] and flg[j]==-1:
            flg[j]=i
        elif flg[j]==-1:
            break

for i in range(len(flg)-1):
    if flg[i+1]-flg[i]!=1:
        cnt+=1

if cnt<=1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

x = 0
y = 0
z = [0]
for i in range(len(S)):
  if x <= 6:
    #print(S[i])
    #print(s1[x])
    if S[i] == s1[x]:
      x += 1
      z.append(0)
    elif x==0:
      z.append(0)
    else:
      if z[i] == 1:
        z[i] = 0
        z.append(1)
      else:
        z.append(1)
  else:
    break

Submission status: Wrong Answer

Solution code:
S = input()

key = ['k', 'e', 'y', 'e', 'n', 'c' ,'e']

def findkey(s):
    top_index = s.find('k') # 先頭を探す
    sub = s[top_index+1:]
    f = 1
    cnt = 0
    while f < len(key):
        n_index = sub.find(key[f])
#        print(sub, n_index, key[f])
        if n_index < 0: # 次の文字が見つからない時
            return False, top_index
        elif n_index >= 0:
            # 次の文字が欲しいものだった場合
            if f == len(key) - 1: # 見つけ切った
                return True,  top_index
            if n_index + 1 >= len(sub):
                return False,  top_index
            sub=sub[n_index+1:]
            f += 1
            if n_index > 0: # 隙間が空いた場合
                cnt += 1
                if cnt > 1:
                    return False,  top_index
    return False,  top_index

sub = S
i = 0
while i < len(sub):
#    print(sub)
    i = sub.find('k')
    if i < 0:
        flg = False
        break
    else:
        sub = sub[i:]
        flg, i = findkey(sub)
        if flg:
            break
        if i + 1 >= len(sub):
            flg = False
            break
        sub = sub[i+1:]
            
if flg:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = str(input())
 
kchars = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
 
remaining_string = S
current_position = 0
for idx, char in enumerate(kchars):
    if char not in remaining_string:
        # 文字列が見つからなければ失敗
        print('NO')
        break
 
    if idx == len(kchars) - 1:
        # 含まれていた文字列が、最後の文字'e'だった場合、成功
        print('YES')
        break
    else:
        char_index = remaining_string.index(char)
        remaining_string = S[current_position + char_index + 1:]
        current_position += char_index

Submission status: Wrong Answer

Solution code:
import re
str_in_org = input()
KEYENCE = 'keyence'
flag = False
for n in range(1,7):
    str_in = str_in_org
    str_div1 = KEYENCE[:n]    
    str_div2 = KEYENCE[n:]
    if( str_div1 in str_in ):
        str_in = re.split( str_div1, str_in, 2 )[1]
        if( str_div2 in str_in ):
            flag = True
if flag == True :
    print ('YES')
else:
    print ('NO')

Submission status: Wrong Answer

Solution code:
data = input()
comp_s = ['k', 'e', 'y', 'e', 'n', 'c', 'e']

flag = False
ng_flag = False
count = 0
s_count = 0
for s in data:
    if 6 < s_count:
        if not ng_flag:
            count += 1
            ng_flag = True
        continue
    elif s == comp_s[s_count]:
        s_count += 1
        ng_flag = False
    else:
        if not ng_flag:
            count += 1
            ng_flag = True

if 6 == s_count and count <= 1:
    flag = True

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

Submission status: Wrong Answer

Solution code:
S = input()

P = "keyence"
a = 0
c = 0

i = 0
j = 0

while i < 7 and j < len(S):
  if S[j] == P[i]:
    i += 1
    a = 0
  elif a == 0:
    a = 1
    c += 1
  j += 1

if c == 0 and i == 7:
  print("YES")
elif c == 1 and j == len(S) and i == 7:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import re
from sys import stdin
N=(stdin.readline().rstrip())
for i in range(7):
    mae="keyence"[0:i+1]
    ato="keyence"[i+1:8]
    if N.count("keyence")>1:
        print("NO")
        break
    if (re.sub('.*keyence', '', N)=="")==True:
        print("YES")
        break
    if (re.sub('keyence.*', '', N)=="")==True:
        print("YES")
        break
    if re.match("%s.*%s"%(mae, ato),N):
        print("YES")
        break
if i==6:
    print("NO")

Submission status: Wrong Answer

Solution code:
var =input()
b =""
flg = False
for a in var:
 
    if "k" in var:
        b= var.find("k")+1
        if "e" in var and var.find("e",b,len(var))+1 > b:
            b= var.find("e",b,len(var))+1
            if "y" in var and var.find("y",b,len(var))+1 > b:
                b= var.find("y",b,len(var))+1
                if "e" in var and var.find("e",b,len(var))+1 > b:
                     b= var.find("e",b,len(var))+1
                     if "n" in var and var.find("n",b,len(var))+1 > b:
                         b= var.find("n",b,len(var))+1
                         if "c" in var and var.find("c",b,len(var))+1 > b:
                             b= var.find("c",b,len(var))+1
                             if "e" in var and var.find("e",b,len(var))+1 > b:
                                 flg = True
if flg:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#coding:utf-8

STRNUM = 8

def concat(str_list):
    s = ""
    for i in str_list:
        s += i
    return s

in_s = input()
is_key = False
keyence = list("keyence")
if "keyence" in in_s:
    splt_res = in_s.split("keyence")
    if(splt_res[0]=="")|(splt_res[1]==""):
        is_key = True
else:
    for i in range(STRNUM-1):
        str1 = concat(keyence[0:i+1])
        str2 = concat(keyence[i+1:])
        # str1 で分割
        if str1 in in_s:
            splt_res = in_s.split(str1)
            if splt_res[0] == "":
                if str2 in splt_res[1]:
                    splt_res2 = splt_res[1].split(str2)
                    if(splt_res2[0]=="")|(splt_res2[1]==""):
                        is_key = True

if is_key == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
K = 'keyence'
for i in range(len(S)):
    if not S[i] in K:
        S = S.replace(S[i], ' ')
S = S.split()
if S==K or S[0]==K or S[0]+S[len(S)-1]==K or S[len(S)-1]==K:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
input_str = input()

str_list = list(input_str)

keyence = list("keyence")

# 各文字が入ってるインデックスを記録する辞書型
str_index_dict = {}
for char in keyence:
    str_index_dict.setdefault(char, [])

for i, char in enumerate(str_list):
    if char in keyence:
        str_index_dict[char].append(i)

can_skip = True  # 文字を飛ばせるのは一回まで
keyence_iter = iter(keyence)

succes = True

position = 0
for char in keyence:
    if str_index_dict[char] == []:
        succes = False
        break
    if char == "k":
        position = min(str_index_dict[char])
        str_index_dict[char].remove(position)
        position+=1
    else:
        if position in str_index_dict[char]:
            str_index_dict[char].remove(position)
            position += 1
        else:
            if can_skip == True:
                position = min(str_index_dict[char])
                str_index_dict[char].remove(position)
                position+=1
                can_skip = False
            else:
                succes = False
                break

if succes == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:


num_list = input()
key = 'keyence'

i = 0

if num_list == key:
    print('YES')

else:
    while num_list[i]==key[i]:
        i+=1
    n = i



    i = -1
    while num_list[i]==key[i]:
        i -= 1
        n += 1

    if n >= 6:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
s=input()
ans='keyence'
i=0 # index of s
index=0 # index of ans
isCut=0
canRestart=0
restart=0
lenS=len(s)
while i<lenS:
    if isCut==1: # 切られたあと
        if index>6: # 7=len(ans)
            if canRestart:
                canRestart=0
                i=restartI+1
                index=restartIndex
            else:
                break
        if s[i]==ans[index]:
            index+=1
        else:
            if canRestart:
                canRestart=0
                isCut=-1
                i=restartI+1
                index=restartIndex
            else:
                break
    elif isCut==-1: # 切られている途中
        if s[i]==ans[index]:
            # 切り方を変えるときはiとindexを戻す
            restartIndex=index
            restartI=i
            canRestart=1
            isCut=1
            index+=1
    else: # 切られる前
        if s[i]==ans[index]:
            index+=1
        else:
            isCut=-1
    print(i,index,isCut)
    i+=1

if index<=6: # 7=len(ans)
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
import re
str_in_org = input()
KEYENCE = 'keyence'
flag = False
for n in range(1,7):
    str_in = str_in_org
    print (n)
    str_div1 = KEYENCE[:n]    
    str_div2 = KEYENCE[n:]
    print(str_div1)
    if( str_div1 in str_in ):
        str_in = re.split( str_div1, str_in, 2 )[1]
        print (str_in)
        if( str_div2 in str_in ):
            flag = True

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

Submission status: Wrong Answer

Solution code:
s=input()

key1=s.find('k')
flag=0
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('e')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('y')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('e')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key1=s.find('n')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]
    
key1=s.find('c')
if key1==-1:
    flag=1
else:
    s=s[key1+1:]

key2=s.count('e')
if flag==1 or key2==-1:
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
S = str(input())
 
kchars = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
 
remaining_string = S
for idx, char in enumerate(kchars):
    if char not in remaining_string:
        # 文字列が見つからなければ失敗
        print('NO')
        break
 
    if idx == len(kchars) - 1:
        # 含まれていた文字列が、最後の文字'e'だった場合、成功
        print('YES')
        break
    else:
        char_index = remaining_string.index(char)
        remaining_string = S[char_index + 1:]

Submission status: Wrong Answer

Solution code:
s = input()
search="keyence"
idx=0
flg = False
ans="NO"
for c in s:
    if c == search[idx]:
        idx += 1
    if idx >= 7:
        flg=True
        break
if flg:
    idx = -1
    for i in range(7):
        x=s.find(search[0:i+1])
        #print("ps=%s, ns=%s, reduce=%s" %(search[0:i+1], search[i+1:], s[x+i+1:]))
        if s[x+i+1:].find(search[i+1:])>=0:
            ans = "YES"
            break
    print(ans)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
input_str = input()

str_list = list(input_str)

keyence = list("keyence")

# 各文字が入ってるインデックスを記録する辞書型
str_index_dict = {}
for char in keyence:
    str_index_dict.setdefault(char, [])

for i, char in enumerate(str_list):
    if char in keyence:
        str_index_dict[char].append(i)

can_skip = True  # 文字を飛ばせるのは一回まで
keyence_iter = iter(keyence)

succes = True

position = 0
for char in keyence:
    if str_index_dict[char] == []:
        succes = False
        break
    if char == "k":
        position = min(str_index_dict[char])
        str_index_dict[char].remove(position)
        position+=1
    else:
        if position in str_index_dict[char]:
            str_index_dict[char].remove(position)
            position += 1
        else:
            if can_skip == True:
                position = min(str_index_dict[char])
                position+=1
                can_skip = False
            else:
                succes = False
                break

if succes == True:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re
s=input()
if re.match("^keyence.*",s) or re.match(".*keyence\Z",s) or re.match("k.*eyence",s)  or re.match("ke.*yence",s) or re.match("key.*ence",s) or re.match("keye.*nce",s) or re.match("keyen.*ce",s)or re.match("keyenc.*e",s) or re.match("keyence",s) :
    print("YES")
else:print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
p = 0
h = 0
for i in range(len(s)):
    if p == 0:
        if i <= 6:
            if s[i] == t[i]:
                h += 1
            if s[i] != t[i]:
                k = i
                p = 1
    elif p == 1:
        if s[i] == t[k]:
            j = i
            p = 2
            h += 1
        if i == len(s) - 1:
            if s[i] == "e" and k == 5:
                print("YES")
                exit()
            else:
                print("NO")
                exit()
    elif p == 2:
        if k + i - j <= 6:
            if s[i] == t[k + i - j]:
                h += 1
            elif s[i] != t[k + i - j]:
                print("NO")
                exit()
        else:
            print("NO")
            exit()
if h == 7:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
target = "keyence"
cnt = 0

for moji in S:
    if target in S:
        print("YES")
        break
    if moji == target[cnt]:
        cnt += 1
    else:
        if target[cnt:] in S:
            print("YES")
            break
        else:
            print("NO")
            break

Submission status: Wrong Answer

Solution code:
# B
S = input()
K = 'keyence'
k = 0
for i in range(1,len(K)):
    n = S.find(K[:i])
    #print(n)#
    #print(S[n+i:],K[i:])#
    m = S[n+i:].find(K[i:])
    #if n>=0 and m>=0:
    #if (n==0 and m>=0) or (n>0 and S[n+i:]==K[i:]):
    if (n==0 and m==0) or (n==0 and m>0 and S[n+i+m:]==K[i:]) or \
        (n>0 and S[n+i:]==K[i:]):
        
        res = 'YES'
        break
else: res = 'NO'        
print(res)

Submission status: Wrong Answer

Solution code:
import re
L = input()
k1 = L.count("k")
e3 = L.count("e")
y1 = L.count("y")
n1 = L.count("n")
c1 = L.count("c")
if k1 >= 1 and e3 >= 3 and y1 >= 1 and n1 >= 1 and c1 >= 1:
    if re.match("k.*eyence", L) or re.match("ke.*yence", L) or re.match("key.*ence", L) or re.match("keye.*nce", L) or re.match("keyen.*ce", L) or re.match("keyenc.*e", L) or re.match("[keyence]+", L):
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Wrong Answer

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

if t in s:
  if s.find(t)==0 or s.find(t)==len(s)-7:
    print("YES")
  else:
    print("NO")
else:
  for i in range(1,7):
    a,b=t[:i],t[i:]
    print(a,b)
    if a in s and b in s:
      if s.find(a)==0 and s.rfind(b)==len(s)-len(b):
        print("YES")
        break
  else:
    print("NO")

Submission status: Wrong Answer

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

for i in range(7):
    if (t[:i] in s) and (t[i:] in s):
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import re
str_in_org = input()
KEYENCE = 'keyence'
flag = False
for n in range(1,7):
    str_in = str_in_org
    print (n)
    str_div1 = KEYENCE[:n]    
    str_div2 = KEYENCE[n:]
    print(str_div1)
    if( str_div1 in str_in ):
        str_in = re.split( str_div1, str_in, 2 )[1]
        print (str_in)
        if( str_div2 in str_in ):
            flag = True

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

Submission status: Wrong Answer

Solution code:
s = input()
target = 'keyence'
s_len = len(s)
flg = 0
for i in range(7):
    target1_ind = -1
    target1 = target[0:i]
    target2 = target[i:7]
    if target1 in s:
        target1_ind = s.index(target1)
        if target2 in s:
            if target1_ind == 0:
                if s.index(target2)+len(target2)==len(s):
                    flg = 1
            else:
                if target1_ind+len(target) == 7:
                    flg = 1

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

Submission status: Wrong Answer

Solution code:

P = list(str(input()))

#print(P[0])

N = len(P)

flg = 0

kaisu = 0

hantei = 0
i=0
j=0
k=0
l=0
m=0
n=0
o =0
w1=0
w2=0
w3=0
w4=0
w5=0
w6=0
w7 =0

for i in range(N):
    if P[i] == "k":
        w1 = i
        flg = 0
        for j in range(i+1,N):
            if P[j]=="e":
                w2 = j
                if w1+1 != w2:
                    flg = flg + 1
                for k in range(j+1,N):
                    if P[k]=="y":
                        w3 = k
                        if w2+1 != w3:
                            flg = flg + 1
                        for l in range(k+1,N):
                            if P[l]=="e":
                                w4 = l
                                if w3+1 != w4:
                                    flg = flg + 1
                                for m in range(l+1,N):
                                    if P[m]=="n":
                                        w5 = m
                                        if w4+1 != w5:
                                            flg = flg + 1
                                        for n in range(m+1,N):
                                                if P[n]=="c":
                                                    w6 = n
                                                    if w5+1 != w6:
                                                        flg = flg + 1
                                                    for o in range(n+1,N):
                                                        if P[o]=="e":
                                                            w7 = o
                                                            if w6+1 != w7:
                                                                flg = flg + 1
                                                            if  flg <= 1:
                                                                #print("YES")
                                                                hantei = hantei +1

if hantei == 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S=input()
K=list('keyence')
n=0
flg=0
i_cut=[0,0]
for i,c in enumerate(S):
  if c==K[n]:
    if flg==1:
      i_cut[1] = i-1
      break 
    n+=1
    if n>=7:
      if flg==0:
        i_cut = [i+1,len(S)]
        break  
  else:
    if flg==0:
      i_cut[0] = i
      flg +=1
 
if S[:i_cut[0]]+S[1+i_cut[1]:]=='keyence':
  print("YES")
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re
L = input()
k1 = L.count("k")
e3 = L.count("e")
y1 = L.count("y")
n1 = L.count("n")
c1 = L.count("c")
if k1 >= 1 and e3 >= 3 and y1 >= 1 and n1 >= 1 and c1 >= 1:
    if re.match(".*keyence", L) or re.match("k.*eyence", L) or re.match("ke.*yence", L) or re.match("key.*ence", L) or re.match("keye.*nce", L) or re.match("keyen.*ce", L) or re.match("keyenc.*e", L) or re.match("keyence.*", L):
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
finalcheck = 0
moji = 'keyence'
for i in range(1,8):
    check = 0;front = False
    for j in range(len(s)-i+1):
        if moji[:i] == s[j:j+i]:
            check = j+i
            if j != 0:front = True
            if i == 7:
                if len(s[:j]) == 0 or len(s[j+i:]) == 0: finalcheck = 1
            break
    if check != 0:
        if front:
            if moji[i:] == s[check:check+len(s)-i]:
                finalcheck = 1
            break
        for j in range(check,len(s)-i+1):
            if moji[i:] == s[j:j+len(s)-i]:
                if check != j:
                    if len(s[j+len(s)-i+1:]) != 0:
                        continue
                finalcheck = 1
                break
    if finalcheck == 1:break
if finalcheck:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
a = str(input())
k = "keyence"
lk = len(k)

ok = 0

s1 = a.find(k)
s2 = len(a[s1:])
if s1 == 0 or s2 == lk:
    ok = 1

if len(a) >= lk:
    for i in range(lk):
        s1 = a.find(k[:i])
        s2 = a[s1+i:].find(k[i:])
        if s1 >= 0 and s2 >= 0:
            if s1 == 0 and len(a[s1+i+s2:]) == len(k[i:]):
                ok = 1

if ok == 1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import re
from sys import stdin
N=(stdin.readline().rstrip())
for i in range(7):
    mae="keyence"[0:i+1]
    ato="keyence"[i+1:8]
    if (re.sub('.*keyence', '', N)=="")==True:
        print("YES")
        break
    if (re.sub('keyence.*', '', N)=="")==True:
        print("YES")
        break
    if re.match("%s.*%s"%(mae, ato),N):
        print("YES")
        break
if i==6:
    print("NO")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

import re

S = input()

if "keyence" == S:
    print("YES")
else:
    patterns = ["^keyence*", "^k*eyence$", "^ke*yence$", "^key*ence$", "^keye*nce$", "^keyen*ce$", "^keyenc*e$", "keyence$"]

    matched = False
    for pattern in patterns:
        matchOB = re.search(pattern, S)
        if matchOB:
            matched = True
            break
    if matched:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
a = 'keyence'
flag = 1

for i in range(8):
    if a[0:i] in s:
        firstindex = s.index(a[0:i])
        if a[i:8] in s[firstindex+i:]:
            secondindex = s.index(a[i:8])
            if firstindex+i == secondindex:
                if s[0:secondindex+7-i] == a or s[firstindex:] == a:
                    print('YES')
                    flag = 0
                    break
            if s[0:firstindex+i]+s[secondindex:] == a:
                print('YES')
                flag = 0
                break

if flag == 1:
    print('NO')

Submission status: Wrong Answer

Solution code:
N=input()
kye="keyence"
Nlen=len(N)
i=0
flag=0
flagz=0
while flag==0 and N[i]==kye[i]:
    if i==6:
        flag=1
    i=i+1

x=i
while flag==0:
    flagz=1
    if x<Nlen and N[x]!=kye[i]:
        x=x+1
    else:
        break
    if x==Nlen-1:
        flag=2
    

while flag==0 and x<Nlen and N[x]==kye[i]:
    if i==6:
        flag=1
    i=i+1
    x=x+1


if flagz==1 and x!=Nlen:
    flag=2

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

Submission status: Wrong Answer

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

keyStr=input()
keyence="keyence"
chkflg=False

for char in range(len(keyence)-1):
  before=keyence[0:char+1]
  after=keyence[char+1:len(keyence)]
  
  bindex= keyStr.find(before)
  if bindex==0 and keyStr[bindex+len(before):len(keyStr)].find(after) >= 0:
    print("YES")
    chkflg=True
    break

if chkflg == False:
  if keyStr.find(keyence) >=0:
    print("YES")
  else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S=input()
# print(S)
if S=="keyence":
	print("Yes")
	exit(0)
a="keyence"
if S[0:len(a)]==a:
	print("YES")
	exit(0)

# print(len(a))
for i in range(0,len(a)):
	# print(i)
	# print(S[0:i])
	# print(a[0:i])
	# print(S[len(S)+i-len(a):len(S)])
	# print(a[i:len(S)])
	
	if S[0:i]==a[0:i] and S[len(S)+i-len(a):len(S)]==a[i:len(S)]:
		print("YES")
		exit(0)
print("NO")
exit(0)