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()
s = "keyence"
flag = False
ans = "NO"
for i in range(len(S)):
  if s[:i] in S:
    s1 = s[:i]
    s2 = s[i:]
    flag = True
    
if flag:
  for i in range(len(S)-len(s1)):
    if s1 == S[i:i+len(s1)]:
      if s2 in S[i+len(s1):]:
        ans = "YES"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
s = "keyence"
flag = False
ans = "No"
for i in range(len(S)):
  if s[:i] in S:
    s1 = s[:i]
    s2 = s[i:]
    flag = True
    
if flag:
  for i in range(len(S)-len(s1)):
    if s1 == S[i:i+len(s1)]:
      if s2 in S[i+len(s1):]:
        ans = "Yes"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

S = input()
S = S.replace('\n','')
s_list = list(S)

K = "keyence"
k_list = list(K)

count = 0
delete_flag = False
finish_delete_flag = False
for i,s in enumerate(s_list):
    if s == k_list[count]:
        if count == len(k_list)-1:
            if i < len(s_list) - 1 and finish_delete_flag:
                count = 0
            else:
                print("YES") 
                exit(0)

        #delete_flagはもう使えないようにする
        if delete_flag:
            finish_delete_flag = True
        count += 1
    else:
        #もう使ったのにまた異なった
        if finish_delete_flag:
            #やりなおし
            count = 0
        else:
            delete_flag = True

print("NO")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

S = input()
S = S.replace('\n','')
s_list = list(S)

K = "keyence"
k_list = list(K)

count = 0
delete_flag = False
finish_delete_flag = False
for s in s_list:
    if s == k_list[count]:
        if count == len(k_list)-1:
            print("YES") 
            exit(0)

        #delete_flagはもう使えないようにする
        if delete_flag:
            finish_delete_flag = True
        count += 1
    else:
        #もう使ったのにまた異なった
        if finish_delete_flag:
            #やりなおし
            count = 0
            delete_flag = False
            finish_delete_flag = False
        else:
            delete_flag = True

print("NO")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

S = input()
S = S.replace('\n','')
s_list = list(S)

K = "keyence"
k_list = list(K)

count = 0
delete_flag = False
finish_delete_flag = False
for s in s_list:
    if s == k_list[count]:
        if count == len(k_list)-1:
            print("YES") 
            exit(0)

        #delete_flagはもう使えないようにする
        if delete_flag:
            finish_delete_flag = True
        count += 1
    else:
        #もう使ったのにまた異なった
        if finish_delete_flag:
            print("NO")
            exit(0)
        else:
            delete_flag = True

print("NO")

Submission status: Wrong Answer

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
import re

S = input()
s = "keyence"
for i in range(len(S)):
    if re.match(s[:i]+".*"+s[i:],S):
        print("YES")
        sys.exit(0)

print("NO")

Submission status: Wrong Answer

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
import re

S = input()
s = "keyence"
for i in range(len(S)):
    if re.match(s[:i]+".*"+s[i:],S):
        print("Yes")
        sys.exit(0)

print("No")

Submission status: Wrong Answer

Solution code:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    key = "keyence"
    if key in S:
        print("YES")
        return

    for i in range(1, 6):
        l = key[:i]
        r = key[i:]
        if S.find(l) != -1 and S.find(r) != -1:
            l_ptr = S.find(l)
            r_ptr = S.find(r)
            if l_ptr < r_ptr:
                print("YES")
                return
    print("NO")
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    key = "keyence"
    if key in S:
        print("YES")
        return

    for i in range(1, 6):
        l = key[:i]
        r = key[i:]
        if S.find(l) and S.find(r):
            if S.find(l) + i <= S.find(r):
                print("YES")
                return
    print("NO")
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    key = "keyence"
    if key in S:
        print("YES")
        return

    for i in range(1, 6):
        l = key[:i]
        r = key[i:]
        if S.find(l) and S.find(r):
            if S.find(l) + i <= S.find(r):
                print("Yes")
                return
    print("No")
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
s = input()
target = "keyence"

for i in range(len(target)):
    sbst1 = target[0:i]
    sbst2 = target[i:]
    ind = s.find(sbst1)
    indx = s.find(sbst2)

    if ind != -1 and indx != -1 and ind < indx:
        print("YES")
        sys.exit()

print("NO")

Submission status: Wrong Answer

Solution code:
import sys
s = input()
target = "keyence"

for i in range(len(target)):
    sbst1 = target[0:i]
    sbst2 = target[i:]
    ind = s.find(sbst1)
    indx = s.find(sbst2)

    if ind != -1 and ind < indx:
        print("YES")
        sys.exit()

print("NO")

Submission status: Wrong Answer

Solution code:
import sys
s = input()
target = "keyence"

for i in range(len(target)):
    sbst1 = target[0:i]
    sbst2 = target[i:]
    ind = s.find(sbst1)
    indx = s.find(sbst2)

    if ind != -1 and ind < indx:
        print("Yes")
        sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
s = input()
k = 'keyence'
ans = 'NO'
for i in range(len(k)):
    k1 = k[:i + 1]
    k2 = k[i + 1:]
    temp = s.replace(k1, '')
    temp = temp.replace(k2, '')
    if k1 in s and k2 in s and temp in s:
        ans = 'YES'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

S = input()
T = 'keyence'
N = len(S)

i = 0
while i<7 and S[i]==T[i]:
    i += 1
j = 0
while j<7 and S[N-1-j]==T[6-j]:
    j += 1
judge(i+j>=7)

Submission status: Wrong Answer

Solution code:
s=input()

n=len(s)
ans="NO"

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

Submission status: Wrong Answer

Solution code:
s=input()

n=len(s)
ans="No"

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

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
if s[0]!='k':
  if s[n-7:n]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[n-1]!='e':
  if s[0:8]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[0]=='k' and s[n-1]=='e':
  for i in range(1,7):
    if s[:i]+s[n-7+i:n]=='keyence':
      print('YES')
      exit()
print('NO')

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
if s[0]!='k':
  if s[n-8:n]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[n-1]!='e':
  if s[0:8]=='keyence':
    print('YES')
  else:
    print('NO')
elif s[0]=='k' and s[n-1]=='e':
  for i in range(1,7):
    if s[:i]+s[n-7+i:n]=='keyence':
      print('YES')
      exit()
print('NO')

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 'keyence'
    cnt = 0
    j = 0
    if S[0] != 'k':
        return 'NO'
        for i in range(len(S)-6):
            if S[i] == ans[j]:
                while True:
                    j += 1
                    i += 1
                    if j == 7:
                        return('YES')
                    elif S[i] != ans[j]:
                        break
        return ('NO')
    else:
        i = 0
        while True:
            i += 1
            j += 1
            if j == 7 and i == len(S):
                return('YES')
            elif S[i] != ans[j]:
                break
        #print(i,j)
        #print(S[69])
        for k in range(i,len(S)-(7-j-1),1):
            tmp = j
            #print(tmp,k,len(S)-j)
            if S[k] == ans[tmp]:
                while True:
                    #print(tmp,k)
                    tmp += 1
                    k += 1
                    if tmp == 7 and k == len(S):
                        return('YES')
                    elif tmp == 7 and k != len(S):
                        return('NO')
                    elif S[k] != ans[tmp]:
                        break
        return('No')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 'keyence'
    cnt = 0
    j = 0
    if S[0] != 'k':
        for i in range(len(S)-6):
            if S[i] == ans[j]:
                while True:
                    j += 1
                    i += 1
                    if j == 7:
                        return('YES')
                    elif S[i] != ans[j]:
                        break
        return ('NO')
    else:
        i = 0
        while True:
            i += 1
            j += 1
            if j == 7 and i == len(S):
                return('YES')
            elif S[i] != ans[j]:
                break
        #print(i,j)
        #print(S[69])
        for k in range(i,len(S)-(7-j-1),1):
            tmp = j
            #print(tmp,k,len(S)-j)
            if S[k] == ans[tmp]:
                while True:
                    #print(tmp,k)
                    tmp += 1
                    k += 1
                    if tmp == 7 and k == len(S):
                        return('YES')
                    elif tmp == 7 and k != len(S):
                        return('NO')
                    elif S[k] != ans[tmp]:
                        break
        return('No')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 'keyence'
    cnt = 0
    j = 0
    if S[0] != 'k':
        for i in range(len(S)-6):
            if S[i] == ans[j]:
                while True:
                    j += 1
                    i += 1
                    if j == 7:
                        return('YES')
                    elif S[i] != ans[j]:
                        break
        return ('NO')
    else:
        i = 0
        while True:
            i += 1
            j += 1
            if j == 7:
                return('YES')
            elif S[i] != ans[j]:
                break
        #print(i,j)
        #print(S[69])
        for k in range(i,len(S)-(7-j-1),1):
            tmp = j
            #print(tmp,k,len(S)-j)
            if S[k] == ans[tmp]:
                while True:
                    #print(tmp,k)
                    tmp += 1
                    k += 1
                    if tmp == 7:
                        return('YES')
                    elif S[k] != ans[tmp]:
                        break
        return('No')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    ans = 'keyence'
    cnt = 0
    j = 0
    if S[0] != 'k':
        for i in range(len(S)-6):
            if S[i] == ans[j]:
                while True:
                    j += 1
                    i += 1
                    if j == 7:
                        return('YES')
                    elif S[i] != ans[j]:
                        break
        return ('NO')
    else:
        i = 0
        while True:
            i += 1
            j += 1
            if j == 7:
                return('YES')
            elif S[i] != ans[j]:
                break
        for k in range(i,len(S)-j,1):
            tmp = j
            if S[k] == ans[j]:
                while True:
                    tmp += 1
                    k += 1
                    if tmp == 7:
                        return('YES')
                    elif S[k] != ans[tmp]:
                        break
        return('No')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    if S == 'keyence':
        return ('YES')
    ans = 'keyence'
    j = 0
    cnt = 0
    i = 0
    if S[0] != 'k':
        cnt += 1
    while i<len(S):
        if S[i] == ans[j]:
            while True:
                j += 1
                i += 1
                if j == 7:
                    return ('YES')
                elif S[i] != ans[j]:
                    cnt += 1
                    if cnt > 1:
                        return('NO')
                    break
        else:
            i += 1

    return('NO')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    if S == 'keyence':
        return ('YES')
    ans = 'keyence'
    j = 0
    cnt = 0
    i = 0
    while i<len(S):
        if S[i] == ans[j]:
            while True:
                j += 1
                i += 1
                if j == 7:
                    return ('YES')
                elif S[i] != ans[j]:
                    cnt += 1
                    if cnt > 1:
                        return('NO')
                    break
        else:
            i += 1

    return('NO')

print(main())

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    if S == 'keyence':
        return ('Yes')
    ans = 'keyence'
    j = 0
    cnt = 0
    i = 0
    while i<len(S):
        if S[i] == ans[j]:
            while True:
                j += 1
                i += 1
                if j == 7:
                    return ('Yes')
                elif S[i] != ans[j]:
                    cnt += 1
                    if cnt > 1:
                        return('No')
                    break
        else:
            i += 1

    return('No')

print(main())

Submission status: Wrong Answer

Solution code:
import sys

S = input()

T = 'keyence'

ans = 0
for s in zip(S, T):
    if s[0] == s[1]:
        ans += 1
    else:
        break

if ans == 7:
    print('YES')
    sys.exit()

for s in zip(S[::-1], T[::-1]):
    if s[0] == s[1]:
        ans += 1
    else:
        break

print('YES' if ans == 7 else 'NO')

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    T = "keyence"
    for i in range(len(S)-7+1):
        skiped = False
        idx = 0
        j = i
        while j < len(S):
            if S[j] == T[idx]:
                idx += 1
            elif skiped:
                break
            else:
                while j + 1 < len(S) and S[j + 1] != T[idx]:
                    j += 1
                skiped = True
            if idx == 7:
                print("YES")
                return
            j += 1
    print("NO")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    s=SI()
    n=len(s)
    for i in range(8):
        s1=s[:i]
        s2=s[n+i-7:]
 
        if s1+s2=="keyence":
            print("Yes")
            exit()
    print("No")
        








if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = str(input()); n = len(s)
kn = 7
if n < kn:
  print("NO")
for i in range(kn):
  temp = s[:i] + s[n-kn+i:]
  if temp == "keyence":
    print("YES")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
s=input()
rem = len(s)-7

if s[rem:] == 'keyence': 
    print('YES')
    exit()
for i in range(8):
    news = s[0:i] + s[i+rem:]
    if news == 'keyence':
        print('YES')
        break
    print(news)
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=input()
l="keyence"
i=0
for j in S:
  if j==l[i]:
    if i==6:
      print("YES")
      break
    else:
      i+=1
else:
  print("NO")

Submission status: Wrong Answer

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

for i in range(len(K) + 1):
    l, r = K[:i], K[i:]
    if l in S and r in S:
        print("YES")
        break
else:
    print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import copy
s=input()
check="keyence"
tmp=6
for i in reversed(s):
  if i == check[tmp]:
    tmp-=1
  else:
    break
  if tmp == -1:
    print("YES")
    exit()
    
tmp2=len(s)-(6-tmp)-1
for i in reversed(s[:tmp2+1]):
  if i != check[tmp]:
    tmp2-=1
  else:
    break
if tmp2 == 0:
  print("YES")
  exit()

tmp3=0
for i in range(tmp2,-1,-1):
  if s[i] == check[tmp]:
    tmp-=1
  else:
    print("NO")
    exit()
  if tmp == -1:
    tmp3=i
    break
if tmp3 == 0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import copy
s=input()
check="keyence"
tmp=0
for i in s:
  if i == check[tmp]:
    tmp+=1
  else:
    break
  if tmp == 7:
    print("YES")
    exit()
tmp2=copy.copy(tmp)
for i in s[tmp:]:
  if i != check[tmp]:
    tmp2+=1
  else:
    break

if tmp2 == len(s):
  print("NO")
  exit()
#print(s[tmp2:],tmp2,tmp)
for i in range(tmp2, len(s)):
  if s[i] == check[tmp]:
    tmp+=1
  else:
    print("NO")
    exit()
  if tmp == 7:
    tmp3=i
    break
if tmp3 == len(s)-1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import copy
s=input()
check="keyence"
tmp=0
if check in s:
  print("YES")
  exit()
for i in s:
  if i == check[tmp]:
    tmp+=1
  else:
    break
tmp2=copy.copy(tmp)
for i in s[tmp:]:
  if i != check[tmp]:
    tmp2+=1
  else:
    break

if tmp2 == len(s):
  print("NO")
  exit()
#print(s[tmp2:],tmp2,tmp)
for i in range(tmp2, len(s)):
  if s[i] == check[tmp]:
    tmp+=1
  else:
    print("NO")
    exit()
    
  if tmp == 7:
    tmp3=i
    break
if tmp3 == len(s)-1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import copy
s=input()
check="keyence"
tmp=0
if check in s:
  print("YES")
  exit()
for i in s:
  if i == check[tmp]:
    tmp+=1
  else:
    break
tmp2=copy.copy(tmp)
for i in s[tmp:]:
  if i != check[tmp]:
    tmp2+=1
  else:
    break

if tmp2 == len(s):
  print("NO")
  exit()

for i in s[tmp2:]:
  if tmp == 6:
    print("YES")
    exit()
  if i == check[tmp]:
    tmp+=1
  else:
    print("NO")
    exit()
print("YES")

Submission status: Wrong Answer

Solution code:
s=input()
ans='No'
for i in range(1,len(s)):
  for j in range(i,len(s)):
    if s[:i]+s[j:]=='keyence':
      ans='Yes'
      break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = "keyence"
for i in range(len(K)):
  print(S[:i], S[(i-(len(K))):])
  if (K[:i] == S[:i]) and (K[(i-(len(K))):] == S[(i-(len(K))):]):
    print("Yes")
    exit()
if K == S[:len(K)] or K == S[(-len(K)):]:
  print("Yes")
  exit()
print("No")

Submission status: Wrong Answer

Solution code:
S = input()
K = "keyence"
for i in range(len(K)):
  print(S[:i], S[(i-(len(K))):])
  if (K[:i] == S[:i]) and (K[(i-(len(K))):] == S[(i-(len(K))):]):
    print("Yes")
    exit()
if K == S[:len(K)] or K == S[(-len(K)):]:
  print("Yes")
  exit()
print("No")

Submission status: Wrong Answer

Solution code:
#15 B - KEYENCE String
S = list(input())

result = 'NO'

for i in range(len(S)):
    Scpy = S.copy()
    for j in range(i,len(S)):
        Scond = Scpy[:i]+Scpy[j:]
        print(Scond)
        if (''.join(Scond)) == ('keyence'):
            result = 'YES'
            break
    else:
        continue
    break
print(result)

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    key_lst = []
    for i in range(1,7):
        key_lst.append(["keyence"[:i],"keyence"[i:]])
    ans = False
    for b,f in key_lst:
        before = s.find(b)
        if before != -1:
            start = before+(len(b)-1) + 1
            afst = s[start:]
            after = afst.find(f)
            if after != -1:
                ans = True
    print("YES" if ans else "NO")
main()

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    key_lst = list("keyence")
    ans = True
    for i in key_lst:
        for j,x in enumerate(s):
            if i == x:
                s = s[j+1:]
                break
        else:
            ans = False
    print("YES" if ans else "NO")
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#キーエンス プログラミング コンテスト 2019 b
s=input()
ans=False
for x in range(len(s)):
    for y in range(x,len(s)):
        if s[:x]+s[y:]==s:
            ans=True
if ans:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
k = 'keyence'
Srev = S[::-1]
krev = k[::-1]

ans = 'No'
for i in range(8):
    if S[:i]==k[:i] and Srev[:(7-i)]==krev[:(7-i)]:
        ans = 'Yes'

print(ans)

Submission status: Wrong Answer

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

j, cnt = 0, 0
flag = False
for i in range(len(s)):
    if s[i] == q[j]:
        j += 1
        if flag:
            cnt += 1
        if j == len(q) - 1:
            break
        flag = False
    else:
        flag = True

if i < len(s)-1:
    cnt += 1

if j == len(q)-1 and cnt <= 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

j, cnt = 0, 0
flag = False
for i in range(len(s)):
    if s[i] == q[j]:
        j += 1
        if flag:
            cnt += 1
        if j == len(q) - 1:
            break
        flag = False
    else:
        flag = True

if i < len(s):
    cnt += 1

if j == len(q)-1 and cnt <= 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

j, cnt = 0, 0
flag = False
for i in range(len(s)):
    if s[i] == q[j]:
        j += 1
        if flag:
            cnt += 1
        if j == len(q) - 1:
            break
        flag = False
    else:
        flag = True

if j == len(q)-1 and cnt <= 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
a = len(S)
count=0
for i in range(a):
  for j in range(i+1,a):
    XX= S[:i] +S[j:a]
    
    if XX == 'keyence':
      count +=1
if count == 0:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
u=str(input())
S=u.replace(' ','z')
print(S)
A=[]
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if i<=j:
            A.append(S.replace(S[i-1:j],'',1))
if 'keyence' in A:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=str(input())
A=[]
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if i<=j:
            A.append(S.replace(S[i:j],''))
if 'keyence' in A:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=str(input())
A=[]
for h in range(len(S)):
    for i in range(len(S)):
        for j in range(len(S)):
            for k in range(len(S)):
                if h<=i and i<=j and j<=k:
                    A.append(S[h-1:i]+S[j:k+1])
A.append(S)
if 'keyence' in A:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=list(input())
T=list('keyence')
A=[]
B=[]
C=[]
a=0
for i in range(len(S)):
    if S[i]==T[a]:
        A.append(i)
        if a<=5:
            a+=1
if len(A)!=7:
    print('NO')
elif A==[0,1,2,3,4,5,6]:
    print('YES')
else:
    for i in range(0,A[len(A)-1]+1):
        B.append(i)
    for i in range(len(B)):
        if B[i] not in A:
            C.append(B[i])
    if C[len(C)-1]-C[0]==len(C)-1:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
c = "keyence"
if S[-7:] == c or S[:7] == c:
    print("YES")
else:
    for i in range(1, 7):
        c_, _c = c[:i], c[i:]
        if S[:i] == c_ and S[-(i + 1):] == _c:
            print("YES")
            break
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
rest = 0
c = "keyence1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
now = 0
flag = 1
complete = 0
for s in S:
    if s == c[now] and complete == 0:
        if complete == 0:
            now += 1
        if now > 6:
            complete = 1
        flag = 0
    else:
        if flag == 0:
            rest += 1
        flag = 1

    if rest > 1:
        print("NO")
        break
else:
    if complete:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
rest = 0
c = "keyence"
now = 0
flag = 1
for s in S:
    if s == c[now]:
        now += 1
        flag = 0
        if now > 6:
            print("YES")
            break
    else:
        if flag == 0:
            rest += 1
        flag = 1

    if rest > 1:
        print("NO")
        break
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
else:
  print("YES")
  exit()
for j in range(7-i):
  if k[-j-1]!=s[-j-1]:
    print(k[7-j:])
    t+=k[7-j:]
    break
else:
  print("YES")
  exit()
print(t)
print("YES" if t==k else "NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
else:
  print("YES")
  exit()
for j in range(7-i):
  if k[-j-1]!=s[-j-1]:
    t+=k[7-j:]
    break
print("YES" if t==k else "NO")

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
if s==k:
  print("YES")
  exit()
for j in range(7):
  if k[-j-1]!=s[-j-1]:
    t+=k[7-j:]
    break
print("YES" if t==k else "NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
j = "keyence"
now = 0
out = 0
for i in range(len(S)):
  if S[i] == j[now]:
    now += 1
    if now == 7:
      break
  else:
    out += 1
    if out == 2:
      break
if now == 7:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
j = "keyence"
now = 0
out = 0
for i in range(len(S)):
  if S[i] == j[now]:
    now += 1
    if now == 7:
      break
  else:
    out += 1
    if out == 2:
      break
if now == 7:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

S = input()
T = "keyence"

if T in S:
    print("YES")
    exit()
for i in range(1, 7):
    left = T[:i]
    right = T[i:]
    l_idx = S.find(left) 
    if l_idx == - 1:
        continue
    r_idx = S[l_idx + len(left):].find(right) 
    if r_idx == - 1:
        continue
    print("YES")
    exit()
print("NO")

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

S = input()
T = "keyence"

if T in S:
    print("YES")
    exit()
for i in range(1, 7):
    left = T[:i]
    right = T[i:]
    l_idx = S.find(left) 
    r_idx = S.find(right) 
    if l_idx == - 1 or r_idx == -1:
        continue
    if l_idx + len(left) <= r_idx:
        print("YES")
        exit()
print("NO")