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:
from pprint import pprint

s = str(input())

keyence_list = [[float("inf"),-float("inf")] for _ in range(6)]



#前から探す
for i in range(len(s)-6):
    if s[i] == "k":
        if s[i+1] == "e":
            if s[i+2] == "y":
                if s[i+3] == "e":
                    if s[i+4] == "n":
                        if s[i+5] == "c":
                            if s[i+6] == "e":
                                print("YES")
                                exit()
                            else:
                                keyence_list[0][0] = min(keyence_list[0][0],i)
                        else:
                            keyence_list[1][0] = min(keyence_list[1][0],i)
                    else:
                        keyence_list[2][0] = min(keyence_list[2][0],i)
                else:
                    keyence_list[3][0] = min(keyence_list[3][0],i)
            else:
                keyence_list[4][0] = min(keyence_list[4][0],i)
        else:
            keyence_list[5][0] = min(keyence_list[5][0],i)
    else:
        pass

#後ろから探す
for j in range(len(s)-1,5,-1):
    if s[j] == "e":
        if s[j-1] == "c":
            if s[j-2] == "n":
                if s[j-3] == "e":
                    if s[j-4] == "y":
                        if s[j-5] == "e":
                            if s[j-6] == "k":
                                print("YES")
                                exit()
                            else:
                                keyence_list[5][1] = max(keyence_list[0][1],j)
                        else:
                            keyence_list[4][1] = max(keyence_list[1][1],j-1)
                    else:
                        keyence_list[3][1] = max(keyence_list[2][1],j-2)
                else:
                    keyence_list[2][1] = max(keyence_list[3][1],j-3)
            else:
                keyence_list[1][1] = max(keyence_list[4][1],j-4)
        else:
            keyence_list[0][1] = max(keyence_list[5][1],j-5)
    else:
        pass

#pprint(keyence_list)


for k in range(6):
    for l in range(k,6):
        if keyence_list[k][0] < keyence_list[l][1]:
            print("YES")
            exit()

print("NO")
exit()





#下記のリストを埋めていく
#[[{keyenc},{e}],
# [{keyen},{ce}],
# [{keye},{nce}],
# [{key},{ence}],
# [{ke},{yence}],
# [{k},{eyence}]]
#
# 0列目はsを前から走査し、1列目はsを後ろから走査
# 0列目のset{}の中で最小のものと、1列目のset{}の中で最大のものの大小関係がおかしくなければTrue

Submission status: Wrong Answer

Solution code:
from pprint import pprint

s = str(input())

keyence_list = [[float("inf"),-float("inf")] for _ in range(6)]



#前から探す
for i in range(len(s)-6):
    if s[i] == "k":
        if s[i+1] == "e":
            if s[i+2] == "y":
                if s[i+3] == "e":
                    if s[i+4] == "n":
                        if s[i+5] == "c":
                            if s[i+6] == "e":
                                print("YES")
                                exit()
                            else:
                                keyence_list[0][0] = min(keyence_list[0][0],i)
                        else:
                            keyence_list[1][0] = min(keyence_list[1][0],i)
                    else:
                        keyence_list[2][0] = min(keyence_list[2][0],i)
                else:
                    keyence_list[3][0] = min(keyence_list[3][0],i)
            else:
                keyence_list[4][0] = min(keyence_list[4][0],i)
        else:
            keyence_list[5][0] = min(keyence_list[5][0],i)
    else:
        pass

#後ろから探す
for j in range(len(s)-1,-6,-1):
    if s[j] == "e":
        if s[j-1] == "c":
            if s[j-2] == "n":
                if s[j-3] == "e":
                    if s[j-4] == "y":
                        if s[j-5] == "e":
                            if s[j-6] == "k":
                                print("YES")
                                exit()
                            else:
                                keyence_list[0][1] = max(keyence_list[0][1],j)
                        else:
                            keyence_list[1][1] = max(keyence_list[1][1],j-1)
                    else:
                        keyence_list[2][1] = max(keyence_list[2][1],j-2)
                else:
                    keyence_list[3][1] = max(keyence_list[3][1],j-3)
            else:
                keyence_list[4][1] = max(keyence_list[4][1],j-4)
        else:
            keyence_list[5][1] = max(keyence_list[5][1],j-5)
    else:
        pass

#pprint(keyence_list)


for k in range(6):
    for l in range(k,6):
        if keyence_list[k][0] < keyence_list[l][1] < float("inf"):
            print("YES")
            exit()

print("NO")
exit()





#下記のリストを埋めていく
#[[{keyenc},{e}],
# [{keyen},{ce}],
# [{keye},{nce}],
# [{key},{ence}],
# [{ke},{yence}],
# [{k},{eyence}]]
#
# 0列目はsを前から走査し、1列目はsを後ろから走査
# 0列目のset{}の中で最小のものと、1列目のset{}の中で最大のものの大小関係がおかしくなければTrue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    S  = input()
    K = 'keyence'
    if len(S)<=7:
        if S == K:
            print('YES')
        else:
            print('NO')
    else :
        ShaveN = len(S) - 7
        for i in range(len(S) - ShaveN + 1):
            Shave = S[:i] + S[i+ShaveN:]
            print(Shave)
            if Shave == K:
                print('YES')
                return
        print('NO')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S  = input()
    K = 'keyence'
    if len(S)<=7:
        if S == K:
            print('YES')
        else:
            print('NO')
    else :
        ShaveN = len(S) - 7
        for i in range(ShaveN+1):
            Shave = S[:i] + S[i+ShaveN:]
            if Shave == K:
                print('YES')
                return
        print('NO')



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
key = "keyence"
for i in range(len(key)):
    if key[: i] in s and key[i:] in s:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
key = "keyence"
for i in range(len(key)):
    if key[: i] in s and key[i:] in s:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

Solution code:
import re
s = input()
ok = False
if re.match(r'.*keyence', s): ok = True
if re.match(r'k.*eyence', s): ok = True
if re.match(r'ke.*yence', s): ok = True
if re.match(r'key.*ence', s): ok = True
if re.match(r'keye.*nce', s): ok = True
if re.match(r'keyen.*ce', s): ok = True
if re.match(r'keyenc.*e', s): ok = True
if re.match(r'keyence.*', s): ok = True
print('YES' if ok else 'NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
a = []
a += [re.search(r'.*keyence', s)]
a += [re.search(r'k.*eyence', s)]
a += [re.search(r'ke.*yence', s)]
a += [re.search(r'key.*ence', s)]
a += [re.search(r'keye.*nce', s)]
a += [re.search(r'keyen.*ce', s)]
a += [re.search(r'keyenc.*e', s)]
a += [re.search(r'keyence.*', s)]
if any(a):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import re
s = input()
a = []
a += [re.match(r'.*keyence', s)]
a += [re.match(r'k.*eyence', s)]
a += [re.match(r'ke.*yence', s)]
a += [re.match(r'key.*ence', s)]
a += [re.match(r'keye.*nce', s)]
a += [re.match(r'keyen.*ce', s)]
a += [re.match(r'keyenc.*e', s)]
a += [re.match(r'keyence.*', s)]
if any(a):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

print("NO")

Submission status: Wrong Answer

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

print("NO")

Submission status: Wrong Answer

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

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

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

print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
keyence = ["k", "e", "y", "e", "n", "c", "e"]
idx = 0
for i in range(len(s)):
    if s[i] == keyence[idx]:
        idx += 1
    if idx == len(keyence):
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
import re
s = input()
pattern = "k*e*y*e*n*c*e"

if re.match(pattern, s):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
str = 'keyence'
pattern_keyence = []
for i in range(len(str)+1):
    pattern_keyence.append(repr(str[:i]+'.*'+str[i:]))
for p in pattern_keyence:
    if re.fullmatch(p,S):
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

S = input()
target = "keyence"
del_len = len(S) - len(target)

if S=="target":
    print("YES")
else:
    for i in range(len(S) - del_len+1):
        s = S[:i] + S[i + del_len:]
        print(s)
        if s==target:
            print("YES")
            sys.exit()
print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
if ('keyence' in S
        or (S.find('k') != -1 and S.find('eyence') != -1 and S.find('k') < S.rfind('eyence'))
        or (S.find('ke') != -1 and S.find('yence') != -1 and S.find('ke') < S.rfind('yence'))
        or (S.find('key') != -1 and S.find('ence') != -1 and S.find('key') < S.rfind('ence'))
        or (S.find('keye') != -1 and S.find('nce') != -1 and S.find('keye') < S.rfind('nce'))
        or (S.find('keyen') != -1 and S.find('ce') != -1 and S.find('keyen') < S.rfind('ce'))
        or (S.find('keyenc') != -1 and S.find('e') != -1 and S.find('keyenc') < S.rfind('e'))
    ):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
if ('keyence' in S
        or (S.find('k') != -1 and S.find('eyence') != -1 and S.find('k') < S.find('eyence'))
        or (S.find('ke') != -1 and S.find('yence') != -1 and S.find('ke') < S.find('yence'))
        or (S.find('key') != -1 and S.find('ence') != -1 and S.find('key') < S.find('ence'))
        or (S.find('keye') != -1 and S.find('nce') != -1 and S.find('keye') < S.find('nce'))
        or (S.find('keyen') != -1 and S.find('ce') != -1 and S.find('keyen') < S.find('ce'))
        or (S.find('keyenc') != -1 and S.find('e') != -1 and S.find('keyenc') < S.find('e'))
    ):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

key = list("keyence")

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == key and not flg:
            print("YES")
            flg = True
            break

if not flg:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

key = list("keyence")

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == key and not flg:
            print("YES")
            exit()

if not flg:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

key = list("keyence")

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[:i]+S[j:]

        if tmp == key and not flag:
            print("YES")
            exit()

if not flg:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

key = list("keyence")

k = 0
f = True
cnt = 0
for i in range(len(S)):
    if len(key) == k:
        cnt+=1
        continue
    if S[i] == key[k]:
        f = True
        k+=1
    else:
        if f :
            cnt+=1
        f = False
        

if cnt >1 or k != len(key):
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern1 = r'{}{}'.format(b, a)
    pattern2 = r'{}.*{}'.format(b, a)
    if re.findall(pattern1, s) or re.findall(pattern2, s):
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern = r'.*{}.*{}.*'.format(b, a)
    if re.findall(pattern, s):
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)
bParam = 0
stopParam = 0

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    elif (bParam == 0 and stopParam == 0) or bParam != idx:
        bParam = idx
        stopParam += 1
    elif bParam == idx:
        continue
    else:
        stopParam += 2
        break 


    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr) and stopParam <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)
bParam = 0
stopParam = 0

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    elif (bParam == 0 and stopParam == 0) or bParam != idx:
        bParam = idx
        stopParam += 1
    else:
        stopParam += 2
        break 


    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr) and stopParam <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    if b in s and a in s:
        if s == 'keyence':
            print('YES')
            break

        spb = [sp for sp in s.split(b) if sp != '']
        spa = [sp for sp in s.split(a) if sp != '']
        if len(spb) == len(spa) == 1:
            print('YES')
            break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)
bParam = 0
stopParam = 0

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    elif (bParam == 0 and stopParam == 0) or bParam != idx:
        bParam = idx
        stopParam += 1


    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr) and stopParam <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)
bParam = 0
stopParam = 0

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    elif bParam == 0 or bParam != idx:
        bParam = idx
        stopParam += 1


    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr) and stopParam <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    if b in s and a in s:
        if s == 'keyence':
            print('YES')
            break
        if len(s.split(b)[1].split(a)) == 2:
            print('YES')
            break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    if b in s and a in s:
        if s == 'keyence':
            print('YES')
            break
        if s.split(b)[1].split(a):
            print('YES')
            break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()

chkStr = ["k","e","y","e","n","c","e"]

inpStr = list(s)
idx = 0

chkCount = 0


# print(chkStr)
# print(inpStr)

for i in range(len(inpStr)):
    if chkStr[idx] == inpStr[i]:
        idx += 1
        chkCount += 1
    
    if idx == len(chkStr):
        break


if chkCount == len(chkStr):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    if b in s and a in s:
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

S = input()
key = 'keyence'
K = []

for i in range(len(key)+1):
    K.append([key[:i],key[i:]])


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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

S = input()

if 'key' in S and 'ence' in S:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
def main():
    S = list(input())
    tmp = list('keyence')
    st = -1; ed = -1
    if S[0] == tmp[0]:
        st = 0
        for i in range(1, len(tmp)):
            if S[i] == tmp[i]:
                st += 1
            else:
                break
    if st+1 == len(tmp):
        print('YES')
        return
    if S[-1] == tmp[-1]:
        ed = 0
        for i in range(1, len(tmp)):
            if S[-1-i] == tmp[-1-i]:
                ed += 1
            else:
                break
    if ed+1 == len(tmp):
        print('YES')
        return
    if st == -1 or ed == -1:
        print('NO')
        return
    s = tmp[:st+1] + tmp[-ed-1:]
    if s == tmp:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()

import sys

for i in range(0,len(S)-1):
    for j in range(i+1,len(S)):
        if S[:i] + S[j:] == 'keyence':
            print('Yes')
            sys.exit()
        
print('No')

Submission status: Wrong Answer

Solution code:
import itertools

S = list(input())
KEY = list('keyence')
LK = len(KEY)
L = len(S)
ok = False
for s,t in itertools.combinations(range(L),2):
  idx = 0
  sub_S = S[0:s] + S[t:]
  if sub_S == KEY:
    ok = True
    
if ok:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = list(input())
KEY = list('keyence')
L = len(KEY)
idx = 0
cnt = 0
flg = False
for s in S:
  if idx <= L-1 and s == KEY[idx]:
    idx += 1
    flg = False
  else:
    if not flg:
      cnt += 1
      flg = True
    
if idx == L and cnt <= 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = list(input())
KEY = list('keyence')
L = len(KEY)
idx = 0
cnt = 0
flg = False
for s in S:
  if s == KEY[idx]:
    idx += 1
    flg = False
  else:
    if not flg:
      cnt += 1
      flg = True
  if idx == L:
    break
    
if idx == L and cnt <= 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = list(input())
KEY = list('keyence')
L = len(KEY)
idx = 0
for s in S:
  if s == KEY[idx]:
    idx += 1
  if idx == L:
    break
    
if idx == L:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

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


for i in range(L):
    count = 0
    for j in range(i, L):
        if (i == 0 and count == 0):
            s = S[1:]
        elif(i == L - 1):
            s = S[:i]
        else:
            s = S[:i] + S[i + count + 1:]

        if (s == 'keyence'):
            print('YES')
            exit()
        else:
            count += 1

print('NO')

Submission status: Wrong Answer

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

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

for i in range(L):
    count = 0
    for j in range(i, L):
        if (i == 0 and count == 0):
            s = S[1:]
        elif(i == L - 1):
            s = S[:i]
        else:
            s = S[:i] + S[i + count + 1:]

        if ('keyence' not in s):
            count += 1
        else:
            print('YES')
            exit()

print('NO')

Submission status: Wrong Answer

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

for i in range(L):
    count = 0
    for j in range(i, L):

        if (i == 0 and count == 0):
            s = S[1:]
        elif(i == L - 1):
            s = S[:i]
        else:
            s = S[:i] + S[i + count:]

        if ('keyence' not in s):
            count += 1
        else:
            print('YES')
            exit()

print('NO')

Submission status: Wrong Answer

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

for i in range(L):
    count = 0
    for j in range(i, L):
        s = S[:i] + S[i + count:]
        if (i == 0 and count == 0):
            s = S[1:]
        if ('keyence' not in s):
            count += 1
        else:
            print('YES')
            exit()

print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

ans = "N0"
for i in range(len(S)):
    for j in range(i, len(S)):
        s = S[:i] + S[j:]
        if s == "keyence":
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = "N0"
for i in range(len(S)):
    for j in range(i + 1, len(S)):
        s = S[:i] + S[j:]
        if s == "keyence":
            ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if x == len(match):
        break
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    remainFlag = False
    remain = match[x + 1:]
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(remain))
    for y in range(len(revS)):
        # print(revS[y])
        if y == len(revMatch):
            remainFlag = True
            break
        if revMatch[y] == revS[y]:
            revcheck += revS[y]
        else:
            break
    if remainFlag:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if x == len(match):
        break
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    remainFlag = False
    remain = S[x + 1:]
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(remain))
    for y in range(len(revS)):
        # print(revS[y])
        if y == len(revMatch):
            remainFlag = True
            break
        if revMatch[y] == revS[y]:
            revcheck += revS[y]
        else:
            break
    if remainFlag:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if x == len(match):
        break
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(match))
    for y in range(len(revS)):
        # print(revS[y])
        if y == len(revMatch):
            break
        if revMatch[y] == revS[y]:
            revcheck += revS[y]
        else:
            break

    finalCheck = check + "".join(reversed(revcheck))
    if finalCheck == match:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if x == len(S) - 2:
        break
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(match))
    for y in range(len(revS)):
        # print(revS[y])
        if y == len(revMatch) - 2:
            break
        if revMatch[y] == revS[y]:
            revcheck += revS[y]
        else:
            break

    finalCheck = check + "".join(reversed(revcheck))
    if finalCheck == match:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

match = "keyence"
check = ""
revcheck = ""

flag = False

for x in range(len(S)):
    if match[x] == S[x]:
        check += S[x]
    else:
        flag = True
        break

if flag:
    revS = "".join(reversed(S))
    revMatch = "".join(reversed(match))
    for x in range(len(revS)):
        if revMatch[x] == revS[x]:
            revcheck += revS[x]
        else:
            break

    finalCheck = check + "".join(reversed(revcheck))
    if finalCheck == match:
        print("YES")
    else:
        print("NO")
elif check == match:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
if s.find(k)!=-1:
    print("YES")
    exit()
for i in range(1,7):
    a=s.find(k[:i],0)
    if a>=0:
        b=s.find(k[i:],a+len(k[:i]))
        if b>0:
            print("YES")
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
for i in range(8):
    #print(k[:i],k[i:])
    if k[:i] not in s or k[i:] not in s:
        continue
    elif s.find(k[:i])<s.find(k[i:]):
            print("YES" )
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
for i in range(8):
    print(k[:i],k[i:])
    if k[:i] not in s or k[i:] not in s:
        continue
    else:
        if s.find(k[:i])<s.find(k[i:]):
            print("YES" )
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
for i in range(7):
    if k[:i] not in s or k[i:] not in s:
        continue
    else:
        if s.find(k[:i])<s.find(k[i:]):
            print("YES" )
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
for i in range(7):
    if k[:i] not in s or k[i+1:] not in s:
        continue
    else:
        if s.find(k[:i])<s.find(k[i+1:]):
            print("YES" )
            exit()
print("NO")

Submission status: Wrong Answer

Solution code:
A=["k","e","y","e","n","c","e"]
f=-1;p=0;q=0;r=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i]:
        p=p+1
      else:
        if A[0:p]+A[p:len(A)]==A:
          f=1
          break
        else:
          f=0
          print(A[0:p],A[p:len(A)])
          break
print("YES" if f==1 else "NO")

Submission status: Wrong Answer

Solution code:
A=["k","e","y","e","n","c","e"]
f=-1;p=0;q=0;r=0
S=list(map(str,input()))
if S[0:7]==A or S[len(S)-7:len(S)]==A:
  f=1
else:
  if S[0]!=A[0]:
    f=0
  else:    
    for i in range(len(S)):
      if S[i]==A[i-q]:
        p=p+1
        r=0
        if p==7:
          break
      else:
        if q>0 and r==0:
          f=0
          q=q+1
          
        else:
          r=1
          q=q+1
if f==0:
  print("NO")
  
elif f==1:
  print("YES")
  
else:
  if p==7 and (p+q)==len(S):
    print("YES")
    
  else:
    print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if pattern in s:
    ans = 'YES'

for i in range(1, len(pattern)):
    x = pattern[:i]
    y = pattern[i:]
    p = 0
    while s.find(x, p) >= 0:
        p = s.find(x, p) + len(x)
        if s.find(y, p) >= 0:
            ans = 'YES'
            break

print(ans)