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()
t = "keyence"
p = 0
for i in range(len(s)):
    if p == 0:
        if i <= 6:
            if s[i] != t[i]:
                k = i
                p = 1
    elif p == 1:
        if s[i] == t[k]:
            j = i
            p = 2
        if i == len(s) - 1:
            print("NO")
            exit()
    elif p == 2:
        if k + i - j <= 6:
            if s[i] != t[k + i - j]:
                print("NO")
                exit()
        else:
            print("NO")
            exit()
print("YES")

Submission status: Wrong Answer

Solution code:
#!/Users/takahiro.kida/git/atcorder/venv/bin/python

import numpy
import scipy

from collections import defaultdict
from pprint import pprint

S = input()
ANS = "keyence"

i = 0
started_delete = False
deleted = False
ansed = False
for s in S:
    if s == ANS[i]:
        if started_delete:
            started_delete = False
        if i == len(ANS) - 1:
            print("YES")
            ansed = True
            break
        i += 1;
        continue
    if started_delete:
        continue
    if not deleted:
        started_delete = True
        deleted = True
        continue
    else:
        break

if not ansed:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
i = 0
a = [0]*7
while i < n:
    if s[i] == 'k':
        i += 1
        break
    else:
        i += 1
        a[0] = 1
        if i == n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[1] = 1
        if i ==n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'y':
        i += 1
        break
    else:
        i += 1
        a[2] = 1
        if i ==n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[3] = 1
        if i == n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'n':
        i += 1
        break
    else:
        i += 1
        a[4] = 1
        if i ==n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'c':
        i += 1
        break
    else:
        i += 1
        a[5] = 1
        if i ==n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[6] = 1
        if i == n:
            print('NO')
            exit()
if i == n:
    print('NO')
    exit()
if a.count(1) <= 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


S = ii(str).lower()
if S.count("e") < 3:
    print("NO")
    exit()
for s in ["k", "y", "n", "c"]:
    if S.count(s) < 1:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = "keyence"
a = i = 0

while True:
    if len(s) == i:
        break
    
    if s[i] == t[i]:
        a += 1
    else:
        break
    i += 1

i = len(s) - 1
o = len(t) - 1

while True:
    if i == -1:
        break
    
    if s[i] == t[o]:
        a += 1
    else:
        break
    i -= 1
    o -= 1

if a == len(t) or 14:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import sys
s = input()
l =[ ['keyence'],['k','eyence'],['ke','yence'],['key','ence'],['keye','nce'],['keyen','ce'],['keyenc','e']]

for i in l:
    tmps = s
    ok = True
    for j in i:
        f = tmps.find(j)
        if f == -1:
            ok = False
        tmps = tmps[f:]
    if ok:
        print('YES')
        sys.exit(0)
print('NO')

Submission status: Wrong Answer

Solution code:
S = "keyence"
line = input()
cnt = 0
for i in range(7):
    if(line.find(S[i+1:]) > line.find(S[0:i+1])>= 0): cnt += 1
    #print(S[0:i+1], S[i+1:])
if(cnt>0): print("YES")
else: print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
ans = 'NO'
if 14 < len(s):
    ans = 'NO'
elif s == 'keyence' or s == 'keyofscience':
    ans = 'YES'
else:
    for i in range(len(s)):
        a = s[:i]+s[i+1:]
        if a == 'keyence' or a == 'keyofscience':
            ans = 'YES'
print(ans)

Submission status: Wrong Answer

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

N = len(ans)
k = 0
flag =False
for s in S:
    if s == ans[k]:
        # print(k,s)
        k += 1
        if k == N-1:
            flag = True
            # print('complete')
            break

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

Submission status: Wrong Answer

Solution code:
s = input()

if s.startswith('k') and s.startswith('eyence'):
  print('YES')
elif s.startswith('ke') and s.startswith('yence'):
  print('YES')
elif s.startswith('key') and s.startswith('ence'):
  print('YES')
elif s.startswith('keye') and s.startswith('nce'):
  print('YES')
elif s.startswith('keyen') and s.startswith('ce'):
  print('YES')
elif s.startswith('keyenc') and s.startswith('e'):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

A = ["k","ke","key","keye","keyen","keyenc"]
A = list(reversed(A))
B = ["eyence","yence","ence","nce","ce","e"]
ans = "NO"

if "keyence" in S :
    ans = "YES"
else :
    for i in range(len(A)) :
        if S[:len(A[i])] == A[i] :
            if (B[i] in S) and (S[-len(B[i]):] == B[i]) :
                ans = "YES"
            else :
                ans = "NO"
print(ans)

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

sin = input()
key = "keyence*"
ans = "YES"
i = 0
miss = False
cont = False
for c in sin:
    if i <= 7 and c == key[i]:
        i += 1
        if miss:
            cont = False
    elif not miss:
        miss = True
        cont = True
    else:
        if not cont:
            ans = "NO"
            break

if i != 7:
    ans = "NO"
if sin[-7:] == "keyence":
    ans = "YES"

print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
check=0

answer='NO'

for i in range(len(S)):
  if check==0 and S[i]=='k':
    check+=1
  elif check==1 and S[i]=='e':
    check+=1
  elif check==2 and S[i]=='y':
    check+=1
  elif check==3 and S[i]=='e':
    check+=1
  elif check==4 and S[i]=='n':
    check+=1
  elif check==5 and S[i]=='c':
    check+=1
  elif check==6 and S[i]=='e':
    answer='YES'

print(answer)

Submission status: Wrong Answer

Solution code:
A=input()
char=len(A)-7
flag=0

if A[:7]=="keyence":
    flag=1

for i in range(len(A)-7):
    if A[:i]+A[i+char:]=="keyence":
        flag=1
    #print(A[:i]+A[i+char:])
if flag==1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = "keyence"
line = input()
cnt = 0
for i in range(7):
    if(line.find(S[i+1:]) >= line.find(S[0:i+1])>= 0): cnt += 1
    #print(S[0:i+1], S[i+1:])
if(cnt>0): print("YES")
else: print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

keyword = 'keyence'
cnt = 0
for moji in S:
    if cnt == 7:
        break
    if moji == keyword[0]:
        cnt += 1
        keyword = keyword[1:]

if cnt == 7:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
N = len(s)
k = "keyence"
K = len(k)
flag = False
if s[N - K:] == k:
    print("YES")
    exit()
if s[:K] == k:
    print("YES")
    exit()

for i in range(1, K - 1):
    if s[:i] == k[:i] and s[N - (K - i):] == k[K - i - 1:]:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
import re
S = input()

if re.search(r'k.*eyence', S) or \
   re.search(r'ke.*yence', S) or \
  re.search(r'key.*ence', S) or \
  re.search(r'keye.*nce', S) or \
  re.search(r'keyen.*ce', S) or \
  re.search(r'keyenc.*e', S) or \
  S == 'keyence':
    print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
key = str(input())

for s in 'keyence':
    if s not in key:
        print("NO")
        quit()

print("YES")

Submission status: Wrong Answer

Solution code:
s=input()

ans='keyence'
index=0
isCut=0
isKeyence=0
for si in s:
    if isCut==1:
        if si!=ans[index]:
            isKeyence=0
            break
    elif isCut==-1:
        if si==ans[index]:
            isCut=1
    else:
        if si==ans[index]:
            isKeyence=1
        else:
            isCut=-1
    index+=1
    if index>6:
        break

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

Submission status: Wrong Answer

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

def f(i, j):
    if j == 6:
        return True
    if i == len(S):
        return False
    if S[i] == T[j]:
        return f(i+1, j+1)
    else:
        return g(i+1, j)

def g(i, j):
    if i == len(S):
        return False
    if S[i] != T[j]:
        return g(i+1, j)
    else:
        return h(i+1, j+1)

def h(i, j):
    if j == 6:
        return True
    if i == len(S):
        return False
    if S[i] == T[j]:
        return f(i+1, j+1)
    else:
        return False

print("YES" if f(0, 0) else "NO")

Submission status: Wrong Answer

Solution code:
s = str(input())
n = len(s)
if s == "keyence":
 print("YES")
 exit()
else:
 for I in range(8):
  t = s[0:I]+s[I+n-7:n]
  print(t)
  if t == "keyence":
   print("YES")
   exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
p = 0
for i in range(len(s)):
    if p == 0:
        if i <= 6:
            if s[i] != t[i]:
                k = i
                p = 1
    elif p == 1:
        if s[i] == t[k]:
            j = i
            p = 2
        if i == len(s) - 1:
            print("No")
            exit()
    elif p == 2:
        if k + i - j <= 6:
            if s[i] != t[k + i - j]:
                print("No")
                exit()
        else:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = str(input())

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

remaining_string = S
for idx, char in enumerate(kchars):
    if char not in remaining_string:
        # 文字列が見つからなければ失敗
        print('NO')
        break

    if idx == len(kchars) - 1:
        # 含まれていた文字列が、最後の文字'e'だった場合、成功
        print('YES')
        break
    else:
        char_index = S.index(char)
        remaining_string = S[char_index + 1:]

Submission status: Wrong Answer

Solution code:
s=input()

ans='keyence'
index=0
isCut=0
isKeyence=0
for si in s:
    if isCut==1:
        if si!=ans[index]:
            isKeyence=0
            break
    elif isCut==-1:
        if si==ans[index]:
            isCut=1
    else:
        if si==ans[index]:
            isKeyence=1
        else:
            isCut=-1
    index+=1
    if index>6:
        break

if isKeyence:
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

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

bf = False
judge = False
kn = 0
for i in range(len(S)):
    if kn == 7:
        break
    if S[i] == K[kn]:
        if bf == True:
            judge = True
        kn += 1
    else:
        if judge == True:
            print('NO')
            exit()
        if bf == True:
            continue
        else:
            bf = True

if kn == 7:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
s = input()
n = len(s)
k = 0
for i in range(n):
    for j in range(i,n):
        if "keyence" == s[:i] + s[j+1:]:
            k = 1
            break
if k == 0:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
S = input()
str = "keyence"
frag = False

for a in range(0,len(S) - 6):
  if (S[0:a] + S[a - 7:]) == str:
    frag = True

if frag:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

def f(i, j):
    if j == 6:
        return True
    if i == len(S):
        return False
    if S[i] == T[j]:
        return f(i+1, j+1)
    else:
        return g(i+1, j)

def g(i, j):
    if i == len(S):
        return False
    if S[i] != T[j]:
        return g(i+1, j)
    else:
        return h(i+1, j+1)

def h(i, j):
    if j == 6:
        return True
    if i == len(S):
        return False
    if S[i] == T[j]:
        return f(i+1, j+1)
    else:
        return f(i+1, 0)

print("YES" if f(0, 0) else "NO")

Submission status: Wrong Answer

Solution code:
s = input()

word = "keyence"

for i in range(len(word)):
    a = s.find(word[:i])
    b = s.find(word[i:])
    if(a != -1 and b != -1 and a <= b):
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:

s = input()

f = "keyence"
h = 0
for i in range(7):

    first = f[:i+1]
    second = f[i+1:]
    check = len(first)
    find1 = s.find(first)
    find2 = s.find(second,find1+check)

    if i == 6 and find1 > 0:
        continue

    if i!=6 and find2 + len(second) < len(s):
        continue

    if find1 != -1 and find2!=-1:
        print("YES")
        h = 1
        break



if h == 0:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

len_s = len(S)

key_s = "keyence"

ok = True
for char_i in range(len_s):
    if key_s[char_i] != S[char_i]:
        first_diff_i = char_i
        ok = False
        break

if ok:
    print("YES")
else:
    for rev_char_i in range(len_s):
        char_i = - rev_char_i - 1
        if key_s[char_i] != S[char_i]:
            end_diff_i = char_i
            break
    mod_S = S[:first_diff_i] + S[end_diff_i+1:]
    if mod_S == key_s:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
if S == "keyence":
    print("YES")
    exit(0)

for k in range(N-1):
    for l in range(k+1,N):
        if S[:k]+S[l+1:] == "keyence":
            print("YES")
            exit(0)
print("NO")

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
S = input()
target = 'keyence'


if S.find(target) > -1: print('YES')
else:
    ans = 'NO'
    for i in range(1, len(S)):
        tarl = target[:i]
        tarr = target[i:]
        posl = S.find(tarl)
        posr = S.rfind(tarr) # !!!
        if posl < 0 or posr < 0: continue # not found
        elif posl + i > posr: continue # not in correct order
        else:
            ans = 'YES'
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
import re
if re.compile(r'k.*e.*y.*e.*n.*c.*e').search(input()):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = list(input())
x = list("keyence")
k = 0
count_miss = 0
count_miss1 = 0
for i in range(len(s)):
    if s[i] == x[k]:
        k+=1
        if count_miss == 1:
            count_miss1 = 1
    else:
        count_miss = 1
        if count_miss1 == 1:
            print("NO")
            exit()
    if k==len(x):
        if i != len(s)-1 and count_miss1 == 1:
            print("NO")
            exit()
        break
if k==len(x):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

key = list('keyence ')

index = 0
result = False

for c in S:
  if c == key[index]:
    index += 1

if index == len(key) - 2:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
S = input()
x = "keyence"
OK = False
for i in range(1, 8):
    a = x[:i]
    b = x[i:]
    for j in range(len(S)):
        if S[j:j+i] ==  a:
            for k in range(j+i, len(S)):
                if S[k: k+7-i] == b:
                    print("YES")
                    exit()
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

s = input()

l = deque("keyence")

p = []
c = 0
for i in list(s):
    if l:
        if i == l[c]:
            p.append(i)
            l.popleft()

ss = ''.join(p)
if ss == "keyence":
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = "keyence"
line = input()
cnt = 0
for i in range(7):
    if(line.find(S[0:i+1])>=0 and line.find(S[i+1:])>=0): cnt += 1
if(cnt>0): print("YES")
else: print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

key = list('keyence ')

index = 0
result = False

for c in S:
  if c == key[index]:
    index += 1

if index == len(key) - 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = list(input())
k = list("keyence")

j = 0
cnt = 0
for K in k:
    while j < len(s):
        if K == s[j]:
            cnt += 1
            j += 1
            break
        j += 1

if cnt == len(k):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

k = 'keyence'

for i in range(len(k)):

    if S.find(k[i:]) > S.find(k[:i]) >= 0:
        print('YES')
        exit()

print('NO')

Submission status: Wrong Answer

Solution code:
def m():
    S = input()
    a = 'keyence'
    x = 0
    for i in S:
        if x >=6:
            break
        if i == a[x]:
            x += 1
            continue
    if x >=6:
        return 'YES'
    else:
        return 'NO'

print(m())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
c=0
f=0
for i in range(len(s)):
    if c==7 or f==2:
        break
    elif s[i]==k[c]:
        c+=1
    else:
        f+=1
if c==7:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re

patterns = [
  r'keyence',
  r'k.*eyence',
  r'ke.*yence',
  r'key.*ence',
  r'keye.*nce',
  r'keyen.*ce',
  r'keyenc.*e',
]

def solve(S):
  for pattern in patterns:
    if re.match(pattern, S):
      return 'YES'
  return 'NO'

S = input()

print(solve(S))

Submission status: Wrong Answer

Solution code:
import re
s=input()
print("YES" if re.match("[k]+[e]+[y]+[e]+[n]+[c]+[e]",s) else "NO")

Submission status: Wrong Answer

Solution code:
S = input()
T = "keyence"
lenS = len(S)
lenT = len(T)

i = 0
j = 0
while True:
    if j == lenT:
        print("YES")
        break
    if i == lenS:
        print("NO")
        break

    if S[i] == T[j]:
        j += 1
    i += 1

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
i = 0
a = [0]*7
while i < n:
    if s[i] == 'k':
        i += 1
        break
    else:
        i += 1
        a[0] = 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[1] = 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'y':
        i += 1
        break
    else:
        i += 1
        a[2] = 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[3] = 1
        if i == n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'n':
        i += 1
        break
    else:
        i += 1
        a[4] = 1
        if i ==n:
            print('NO')
            exit()

while i < n:
    if s[i] == 'c':
        i += 1
        break
    else:
        i += 1
        a[5] = 1
        if i ==n:
            print('NO')
            exit()

while i < n:
    if s[i] == 'e':
        i += 1
        break
    else:
        i += 1
        a[6] = 1
        if i ==n:
            print('NO')
            exit()
if a.count(1) <= 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

for i in range(8):
    if a[0:i] in s:
        index = s.index(a[0:i])
        if a[i:8] in s[index:]:
            print('YES')
            flag = 0
            break

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

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
S = input()
target = 'keyence'


if S.find(target) > -1: print('YES')
else:
    ans = 'NO'
    for i in range(1, len(S)):
        tarl = target[:i]
        tarr = target[i:]
        posl = S.find(tarl)
        posr = S.find(tarr)
        if posl < 0 or posr < 0: continue # not found
        elif posl + i > posr: continue # not in correct order
        else:
            ans = 'YES'
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
k="keyence"
c=0
f=0
for i in range(len(s)):
    if c==7 or f==2:
        break
    elif s[i]==k[c]:
        c+=1
    else:
        f=2
if c==7:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

T = "keyence"

start = 0
found = False
for i in range(len(T)):
    found = False
    while start < len(S):
        if S[start] == T[i]:
            start = start + 1
            found = True
            break
        else:
            start = start + 1
    if not found:
        break

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

Submission status: Wrong Answer

Solution code:
import sys

s=input()

target="keyence"
j=0

for i in range(len(target)):
    if target[:i] in s and target[i:] in s:
        print('YES')
        sys.exit()

print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
keyence = "keyence"
for idx, (s, k)  in enumerate(zip(S, keyence)):
    if s==k:
        continue
    else:
        nokori = keyence[idx:]
        if S[-len(nokori):] == nokori:
            print("YES")
            break
        else:
            print("NO")
            break

Submission status: Wrong Answer

Solution code:
Ss = input()

for i in range(8):
    print(i, Ss[:i] + Ss[-7+i:])
    if Ss[:i] + Ss[-7+i:] == 'keyence':
        print('YES')
        break
else:
    print('NO')

Submission status: Wrong Answer

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

for i in tg:
  pos=s.find(i)
  if pos==-1:
    print("NO")
    break
  s=s[pos:]
else:
  print("YES")

Submission status: Wrong Answer

Solution code:
S = input()

k = 'keyence'

for i in range(len(k)):

    if S.find(k[:i]) >= 0 and S.find(k[i:]) >= 0:
        print('YES')
        exit()

print('NO')

Submission status: Wrong Answer

Solution code:
s = raw_input()
ans = 'NO'
string = 'keyence'
for i in xrange(len(string)):
	part1 = string[:i+1]
	index1 = s.find(part1)
	if index1 == -1:
		continue
	part2 = string[i+1:]
	modified = string[index1 + 3:]
	if part2 in modified:
		ans = 'YES'
		break
print ans

Submission status: Wrong Answer

Solution code:
S=input()
def func(S):
  target="keyence"
  for i in range(6):
    a=target[:i]
    b=target[i:]
    if a in S and b in S:
      return True
  return False

if func(S):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import sys

S=input()

L="keyence"

if L in S:
    print("YES")
    sys.exit()

for i in range(1,7):
    if L[:i] in S:
        j=S.index(L[:i])

        if L[i:] in S[j+i:]:
            print("YES")
            sys.exit()
            #print(L[i:],S[j+i:])

print("NO")

Submission status: Wrong Answer

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


def solve():
    S = input()
    for c in 'keyence':
        idx = S.find(c)
        if idx == -1:
            print('NO')
            return
        S = S[idx:]
    print('YES')


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def SS(): return input()


S = SS()
n = 0
cnt = 0
key = 'keyence'
state = 0
for s in S:
    if s == key[n]:
        n += 1
        state = 0
    else:
        if state == 0:
            cnt += 1
        state = 1

    if cnt > 1:
        break
    if n == len(key) - 1:
        print('YES')
        exit()

print('NO')

Submission status: Wrong Answer

Solution code:
S = input()


if "keyence" in S:
    print("YES")
    exit(0)

x = "keyence"

for i in range(len(x)):
    try:
        index1 = S.index(x[:i])
        index2 = S.rindex(x[i:])
        if index1<index2:
            print("YES")
            exit()
    except ValueError:
        continue
print("NO")

Submission status: Wrong Answer

Solution code:

s = input()

f = "keyence"
h = 0
for i in range(7):

    first = f[:i+1]
    second = f[i+1:]
    check = len(first)
    find1 = s.find(first)
    find2 = s.find(second,find1+check)


    if find1 != -1 and find2!=-1:
        print("YES")
        h = 1
        break

if h == 0:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re
s=input()
print("YES" if re.match("k|e|y|e|n|c|e",s) else "NO")

Submission status: Wrong Answer

Solution code:
s = input().rstrip()
k = 0
e = 0
y = 0
n = 0
c = 0
for x in s:
	if x == 'k': k += 1
	if x == 'e': e += 1
	if x == 'y': y += 1
	if x == 'n': n += 1
	if x == 'c': c += 1

if k >=1 and e >= 3 and y >= 1 and n >= 1 and c >= 1 : print('YES')
else: print('NO')

Submission status: Wrong Answer

Solution code:
s=input()
if s.count('keyence') or (s.count('k') and s.count('eyence')) or (s.count('ke') and s.count('yence')) or (s.count('key') and s.count('ence')) or (s.count('keye') and s.count('nce')) or (s.count('keyen') and s.count('ce')) or (s.count('keyenc') and s.count('e')):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import sys
s = input()
for i in range(len(s)):
    for j in range(len(s) - i):
        if s[:i] + s[j:] == "keyence":
            print("YES")
            sys.exit()
print("NO")

Submission status: Wrong Answer

Solution code:
import sys

s=input()

target="keyence"
j=0

for i in range(len(s)):
    if s[i]==target[j]:
        j+=1
    if j==len(target):
        print('YES')
        sys.exit()

print('NO')

Submission status: Wrong Answer

Solution code:
s = input()

if s[0] != 'k':
    if s[-7:] == 'keyence':
        print('YES')
    else:
        print('NO')
elif s[0] == 'k' and s[1] != 'e':
    if s[-6:] == 'eyence':
        print('YES')
    else:
        print('NO')
elif s[0:2] == 'ke' and s[2] != 'y':
    if s[-5:] == 'yence':
        print('YES')
    else:
        print('NO')
elif s[0:3] == 'key' and s[3] != 'e':
    if s[-4:] == 'ence':
        print('YES')
    else:
        print('NO')
elif s[0:4] == 'keye' and s[4] != 'e':
    if s[-3:] == 'nce':
        print('YES')
    else:
        print('NO')
elif s[0:5] == 'keyen' and s[5] != 'c':
    if s[-2:] == 'ce':
        print('YES')
    else:
        print('NO')
elif s[0:6] == 'keyenc' and s[5] != 'e':
    if s[-1] == 'e':
        print('YES')
    else:
        print('NO')
elif s[0:7] == 'keyence':
    print('YES')

Submission status: Wrong Answer

Solution code:
S = input()
res = 'NO'
for s in range(len(S)):
    for t in range(len(S) - s):
        if S[:s] + S[t:] == 'keyence':
            res = 'YES'
print(res)

Submission status: Wrong Answer

Solution code:
s = input()

word = "keyence"

for i in range(len(word)):
    if(word[:i] in s and word[i:] in s):
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

s = input()

f = "keyence"
h = 0
for i in range(7):

    first = f[:i+1]
    second = f[i+1:]

    find1 = s.find(first)
    find2 = s.find(second,find1+1)


    if find1 != -1 and find2!=-1:
        print("YES")
        h = 1
        break

if h == 0:
    print("NO")

Submission status: Wrong Answer

Solution code:
q=input()
A=[]
for i in range(len(q)):
  A.append(q[i])
if A.count("k")>0 and A.count("e")>2 and A.count("y")>0 and A.count("n")>0 and A.count("c")>0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


S = ii(str).lower()
for s in "keyence":
    if s not in S:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
s = input().rstrip()
k = 0
e = 0
y = 0
c = 0
for x in s:
	if x == 'k': k += 1
	if x == 'e': e += 1
	if x == 'y': y += 1
	if x == 'c': c += 1

if k >=1 and e >= 3 and y >= 1 and c >= 1 : print('YES')
else: print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
key = list("keyence")
count = 0
for c in s:
    if key[count] == c:
        count += 1
    if count == 7:
        print("YES")
        exit()
print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
i = 0
while i < n:
    if s[i] == 'k':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'e':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'y':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'e':
        break
    else:
        i += 1
        if i == n:
            print('NO')
            exit()
while i < n:
    if s[i] == 'n':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()

while i < n:
    if s[i] == 'c':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()

while i < n:
    if s[i] == 'e':
        break
    else:
        i += 1
        if i ==n:
            print('NO')
            exit()
print('YES')