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:
# -*- coding: utf-8 -*-

## Library

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

## input

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

S = input()

tmp = 0
first = 0
second = 0

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

for i in range(len(S)):
    if tmp == 0 and S[i:i+3] == "key":
        tmp = 1
        first = i
    if tmp == 1 and S[i:i+4] == "ence":
        tmp = 2
        second = i

if tmp < 2:
    print("NO")
    sys.exit()

if second - first == 3:
    if first == 0 or second == len(S)-4:
        print("YES")
    else:
        print("NO")
else:
    if first == 0 and second == len(S)-4:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

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

## Library

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

## input

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

S = input()

tmp = 0
first = 0
second = 0

for i in range(len(S)):
    if tmp == 0 and S[i:i+3] == "key":
        tmp = 1
        first = i
    if tmp == 1 and S[i:i+4] == "ence":
        tmp = 2
        second = i

if tmp < 2:
    print("NO")
    sys.exit()

if second - first == 3:
    if first == 0 or second == len(S)-4:
        print("YES")
    else:
        print("NO")
else:
    if first == 0 and second == len(S)-4:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

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

s=input().rstrip()
t="keyence"
i,j=0,0
while len(s)>i:
    if j>=7:break
    if s[i]==t[j]:
        j+=1
    i+=1
print("YES"if j==7 else "NO")

Submission status: Wrong Answer

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

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

K = 'keyence'

if K in s:
    splitted = s.split(K)

    if len([spl for spl in splitted if len(spl) > 0]) > 1:
        print('NO')
    else:
        print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
l = list(s)
b = 0
x='keyence'
for i in x:
    if i in l:
        d = l.index(i)
        if (d>=b):
            b=d
            l.remove(l[d])
        elif l[d+1:].index(i):
            d1=l[d+1:].index(i)
            if (d1>=b):
                b=d1
                l.remove(l[d1])
        else:
            print('NO')
            break
    else:
        print('NO')
        break
else:
    print('YES')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = "keyence"
if ans in s:
    print("Yes")
    exit()
for i in range(8):
    if ans[:i+1] ==s[:i+1]:
        if ans[8-i:] == s[len(s)-i:]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
s = input()
ans = "keyence"
if ans in s:
    print("Yes")
    exit()
for i in range(100):
    if ans[:i+1] ==s[:i+1]:
        if ans[8-i:] == s[len(s)-i:]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

print(ans);

Submission status: Wrong Answer

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

print(ans);

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
key="keyence"
li=[]
for i in range(len(key)):
  li.append([key[:i],key[i:]])
  
for i in li:
  if i[0] in s and i[1] in s:
    print("Yes")
    break
else:
  print("No")

Submission status: Wrong Answer

Solution code:

KEY = "keyence"

def main():
    s = input()

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

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

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

    print("No")

main()

Submission status: Wrong Answer

Solution code:

KEY = "keyence"

def main():
    s = input()

    for i in range(1, len(KEY)):
        r = KEY[0:i]
        l = KEY[i:]

        if s.startswith(r) and s.endswith(l):
            print("YES")
            return

    print("No")

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
S = input()
key = 'keyence'
count, start = 0, 0
pre = 'k'
now = 0

for i in S:
    if i == pre and start == 0:
        start = 1
        pre = key[start]
        count = 0
    elif i == pre:
        start += 1
        pre = key[start]
        if start == 6:
            print('YES')
            sys.exit()
        continue
    elif start != 0 and count > 1:
        print('NO')
        sys.exit()
    elif start != 0 and i != pre and now != 0:
        count += 1
        now = 1

print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

"""
7<=|S|<=100
c ∈ {[a-z]}

keyaaence
keyence
"""

ref = "keyence0"
ri = 0
fail = -1
for i in range(len(S)):
    if S[i] == ref[ri]:
        ri += 1
    else:
        if fail >= 0:
            if fail == i - 1:
                fail = i
            else:
                print("NO")
                exit(0)
        else:
            fail = i
if ri == len(ref)-1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

exclude=0
now=False
count=0
for i in range(len(S)):
    s=S[i]
    if count<7:
        if s==key[count]:
            if now:
                now=False
            count+=1
    else:
        if (not now) and exclude>0:
            print("NO")
            exit()
        if not now:
            exclude+=1
            now=True
if count!=7:
    print("NO")
else:
    print("YES")
#print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S=input()
if ('k' in S) and ('eyence' in S):
  print('YES')
  exit()
if ('ke' in S) and ('yence' in S):
  print('YES')
  exit()
if ('key' in S) and ('ence' in S):
  print('YES')
  exit()
if ('keye' in S) and ('nce' in S):
  print('YES')
  exit()
if ('keyen' in S) and ('ce' in S):
  print('YES')
  exit()
if ('keyenc' in S) and ('e' in S):
  print('YES')
  exit()
print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

res = "NO"
x = len(S)-7

for i in range(x):
    if S[:i]+S[i+x:] == "keyence":
        res = "YES"

print(res)

Submission status: Wrong Answer

Solution code:
S = input()

keyence = "keyence1"
n = 0
f = False
f2 = False
for s in S:
    if keyence[n] == s:
        n += 1
        if f:
            f2 = True
    else:
        if f2:
            print("NO")
            break
        f = True

else:
    if n == 7:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

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

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

print('NO')

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)
ans = 'NO'
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      for l in range(k+1,N):
        if S[i:j+1] + S[k:l+1] == 'keyence':
          ans = 'YES'
          break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    S = input()
    if "keyence" in S or "k" in S and "eyence" in S or "ke" in S and "yence" in S or "key" in S and "ence" in S or "keye" in S and "nce" in S or "keyen" in S and "ce" in S or "keyenc" in S and "e" in S:
        print("YES")
    else:
        print("NO")
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re

S=input()
if re.search(r'[a-z]*keyence', S) != None:
  print("YES")
elif re.search(r'k[a-z]*eyence', S) != None:
  print("YES")
elif re.search(r'ke[a-z]*yence', S) != None:
  print("YES")
elif re.search(r'key[a-z]*ence', S) != None:
  print("YES")
elif re.search(r'keye[a-z]*nce', S) != None:
  print("YES")
elif re.search(r'keyen[a-z]*ce', S) != None:
  print("YES")
elif re.search(r'keyenc[a-z]*e', S) != None:
  print("YES")
elif re.search(r'keyence[a-z]*', S) != None:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

    if S.find(string) != -1:
        is_keyence = True

    else:
        for i in range(1, len(string)):
            l = S.find(string[:i])

            if l == -1:
                continue

            r = S.find(string[i:], l + len(string[:i]))
            
            if l != -1 and r != -1 :
                is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    if S.find(string) != -1:
        is_keyence = True

    else:
        for i in range(1, len(string)):
            l = S.find(string[:i])

            if l == -1:
                continue

            r = S.find(string[i:], l + 1)
            
            if l != -1 and r != -1 :
                is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    if S.find(string) != -1:
        is_keyence = True

    else:
        for i in range(1, len(string)):
            l = S.find(string[:i])
            r = S.find(string[i:])
            
            if l != -1 and r != -1 and r > (l + i - 1):
                is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    if S.find(string) != -1:
        is_keyence = True
        
    else:
        for i in range(len(string)):
            l = S.find(string[:i])
            r = S.find(string[i:])
            
            if l != -1 and r != -1 and l < r:
                is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    for i in range(len(string)):
        l = S.find(string[:i])
        r = S.find(string[i:])
        
        if l != -1 and r != -1 and l < r:
            is_keyence = True
    
    if is_keyence:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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

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

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

# 反転させる

foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

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

Submission status: Wrong Answer

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

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

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

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

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

# 反転させる

foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

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

Submission status: Wrong Answer

Solution code:
s=input()
if s[:3]=="key" and s[len(s)-4:]=="ence":
    print("YES")
elif s[:7]=="keyence":
    print("YES")
elif s[len(s)-7:]=="keyence":
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
if s[:3]=="key" and s[len(s)-4:]=="ence":
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
print('YES' if s[:3] == 'key' and s[-4:] == 'ence' else 'NO')

Submission status: Wrong Answer

Solution code:
S = str(input())

flg = False

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

Submission status: Wrong Answer

Solution code:
s = input()
asw='keyence'
l=7
m=len(s)
n=m-7
z=0
if n==0 and s==asw:
	print('YES')
elif n<0:
	print('NO')
elif n>0:
	for i in range(0, n):
		st = s[0:i]
		ed = s[i+n:m+1]
		con = st+ed
		if con==asw:
			print('YES')
			z=1
	if z==0:
		print('NO')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()
ans_flag = False
if "keyence" in s:
  ans_flag = True
  
t = "keyence"
for i in range(1,7):
  first_half = t[:i]
  second_half = t[i:]
  
  try:
    idx = s.index(first_half)
    if s[-len(second_half):] == second_half:
      ans_flag = True
  except:
    pass
print("YES" if ans_flag else "NO")

Submission status: Wrong Answer

Solution code:
s = input()
ans_flag = False
if "keyence" in s:
  ans_flag = True
  
t = "keyence"
for i in range(1,7):
  first_half = t[:i]
  second_half = t[i:]
  
  idx = s.find(first_half)
  if idx != -1:
    if s[-len(second_half):] == second_half:
      ans_flag = True
      
print("YES" if ans_flag else "NO")

Submission status: Wrong Answer

Solution code:
s = input()
ans_flag = 0
if "keyence" in s:
  ans_flag = 1
  
t = "keyence"
for i in range(1,7):
  first_half = t[:i]
  second_half = t[i:]
  
  idx = s.find(first_half)
  if idx != -1:
    if s[idx+1:].find(second_half) != -1:
      ans_flag = 1
      
if ans_flag == 1:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

S = input()
N = len(S)

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

Submission status: Wrong Answer

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

S = input()

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

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

Submission status: Wrong Answer

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

S = input()

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print("NO")

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = list("keyence")
x = 0
y = 0

for c in s:
    if c == ans[x]:
        x += 1
    else:
        y += 1
    if y == 2:
        exit() #抜いていいのは1回まで
    if x == 7:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = list("keyence")
x = 0
y = 0

for c in s:
    if c == ans[x]:
        x += 1
    else:
        y += 1
    if y == 1:
        exit() #抜いていいのは1回まで
    if x == 7:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = list("keyence")
x = 0

for c in s:
    if c == ans[x]:
        x += 1
    if x == 7:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = list("keyence")
x = 0

for c in s:
    if c == ans[x]:
        x += 1
    if x == 6:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

if "keyence" in S:
  print("YES")
elif "keyenc" in S:
  S.replace("keyenc","")
  if "e" in S:
    print("YES")
  else:
    print("NO")
elif "keyen" in S:
  S.replace("keyen","")
  if "ce" in S:
    print("YES")
  else:
    print("NO")
elif "keye" in S:
  S.replace("keye","")
  if "nce" in S:
    print("YES")
  else:
    print("NO")
elif "key" in S:
  S.replace("key","")
  if "ence" in S:
    print("YES")
  else:
    print("NO")
elif "ke" in S:
  S.replace("ke","")
  if "yence" in S:
    print("YES")
  else:
    print("NO")
elif "k" in S:
  S.replace("k","")
  if "eyence" in S:
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
if N<n:
    flag = 0
elif S[:n]==x or S[-n:]==x:
    flag = 1
else:
    for i in range(n):
        if S[i]!=x[i]:
            cur = i
            break
    for j in range(1,n+1):
        if S[-j]!=x[-j]:
            cur2 = N-j
            break
    if S[:cur]+S[cur2+1:]==x:
        flag = 1
    else:
        flag = 0
if flag==1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s=input()

key = "keyence"

for i in range(len(s)):
    j = i + len(s) -7
    if s[:i] + s[j:] == key:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s=input()

key = "keyence"

for i in range(len(s)):
    j = i + len(s) -7
    print(s[:i] + s[j:])
    if s[:i] + s[j:] == key:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
flag = 1
for i in range(N):
    if i<n and S[i]!=x[i]:
        cur = i
        for j in range(1,N+1):
            if j<=n and S[-j]!=x[-j]:
                cur2 = N-j
                if S[:i]+S[cur2+1:]==x:
                    flag = 1
                else:
                    flag = 0
                break
            elif j>n:
                break
        break
if flag==1:
    print("YES")
else:
    print("NO")