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: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
s = list(input())

ans = "NO"
n = len(s)
if n == 7:
    i = 0
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y' and s[i+3] == 'e' and s[i+4] == 'n' and s[i+5] == 'c' and s[i+6] == 'e':
        ans = "YES"

for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y' and s[i+3] == 'e' and s[i+4] == 'n' and s[i+5] == 'c' and s[i+6] == 'e':
        ans = "YES"
for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y' and s[i+3] == 'e' and s[i+4] == 'n' and s[i+5] == 'c':
        for j in range(i+6, n):
            if s[j] == 'e':
                ans = "YES"
for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y' and s[i+3] == 'e' and s[i+4] == 'n':
        for j in range(i+5, n - 1):
            if s[j] == 'c' and s[j+1] == 'e':
                ans = "YES"
for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y' and s[i+3] == 'e':
        for j in range(i+4, n - 2):
            if s[j] == 'n' and s[j+1] == 'c' and s[j+2] == 'e':
                ans = "YES"
for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e' and s[i+2] == 'y':
        for j in range(i+3, n - 3):
            if s[j] == 'e' and s[j+1] == 'n' and s[j+2] == 'c' and s[j+3] == 'e':
                ans = "YES"
for i in range(n - 7):
    if s[i] == 'k' and s[i+1] == 'e':
        for j in range(i+2, n - 4):
            if s[j] == 'y' and s[j+1] == 'e' and s[j+2] == 'n' and s[j+3] == 'c' and s[j+4] == 'e':
                ans = "YES"
for i in range(n - 7):
    if s[i] == 'k':
        for j in range(i+1, n - 5):
            if s[j] == 'e' and s[j+1] == 'y' and s[j+2] == 'e' and s[j+3] == 'n' and s[j+4] == c and s[j+5] == 'e':
                ans = "YES"
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = input()
b = "keyence"
j = 0
for i in a:
  if i==b[j]:
    j+=1
print("YES" if j == 7 else "NO")

Submission status: Runtime Error

Solution code:
def main():
    S = input()

    exam = list("keyence")

    for s in S:
        if s == exam[0]:
            exam.pop(0)
    if len(exam) == 0:
        print("YES")
    else:
        print("NO")


    return 0

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s = input()

k = 'keyence'

ans = ''
j=0
for i, c in enumerate(s):
  if c == k[i]:
    pass
  else:
    ans = s[0:i]
    s = [i:]
    j=i
    break

for i, c in enumerate(s):
  if k[j] == c:
    j = i
    ans += s[i:]
    break

if ans == k:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;

  int n = s.length();

  string keyence = "keyence";
  int p = 0;
  for (int i = 0; i < 7; i++) {
    if (s[i] == keyence[p]) p++;
    else break;
  }
  for (int i = n-7+p; i < n; i++) {
    if (s[i] == keyence[p]) p++;
    else break;
  }

  if (p == 7) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Submission status: Runtime Error

Solution code:
key = tuple("keyence")

S = input().rstrip("\n")

idx = 0
for i in S:
    if i == key[idx]:
        idx += 1

if idx == len(key):
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
from collections import Counter

key = "keyence"

S = input()

idx = 0
for i in S:
    if i == key[idx]:
        idx += 1

if idx == len(key):
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
s=input()
a='keyence'
i=0
f1=False
f2=False
for c in s:
    if c==a[i]:
        f1=False
        i+=1
    else:
        if not f1 and f2:
            print('NO')
            exit()
        else:
            f1=True
            f2=True
if i==7:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
s=input()
word='keyence'
basho=0
for i in s:
  if word[basho]==i:
    basho+=1
print('YES' if basho==7 else 'NO')

Submission status: Runtime Error

Solution code:
l = list(input())
ans = list("keyence")
count = 0
check = 0
check2 = 0
for i in range(len(l)):
  if l[i] == ans[count]:
    check2 = 0
    count += 1
  else:
    if check2 == 1:
      continue
    else:
      check += 1
      check2 = 1
  if count == 7 and 1 >= check:
    print("YES")
    exit()
\
print("NO")

Submission status: Runtime Error

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

import sys
while True:
	s = S.pop()
    if s == A[0]:
      A.pop()
    else:
      pass
    if len(A) == 0:
      print("YES")
      sys.exit()
    if len(S) == 0:
      print("NO")
      sys.exit()

Submission status: Runtime Error

Solution code:
def my_index(l, x, default=0):
    if x in l:
        return l.index(x)
    else:
        return default


T=list("keyence")
x=0
j=0
S=input()
#print(my_index(S,"k"))
if my_index(S,"k")==0:
  for i in range(len(S)):
    if S[i]==T[j]:
      x=x+1
      #print(x)
      j=j+1
    else:
      #print("c")
      continue
  if x==7:
    print("YES")
  else:
    print("NO")    
else:
  for i in range(int(my_index(S,"k")),len(S)):
    if S[i]==T[j] and int(my_index(S,"k"))+7==len(S):
      x=x+1
      #print(x,i)
      j=j+1
    else:
      break
  if x==7 and int(my_index(S,"k"))+7==len(S):
    print("YES")
  else:
    print("NO")

Submission status: Runtime Error

Solution code:
def my_index(l, x, default=0):
    if x in l:
        return l.index(x)
    else:
        return default


T=list("keyence")
x=0
j=0
S=input()
#print(my_index(S,"k"))
if my_index(S,"k")==0:
  for i in range(len(S)):
    if S[i]==T[j]:
      x=x+1
      #print(x)
      j=j+1
    else:
      #print("c")
      continue
  if x==7:
    print("YES")
  else:
    print("NO")    
else:
  for i in range(int(my_index(S,"k")),len(S)):
    if S[i]==T[j]:
      x=x+1
      #print(x,i)
      j=j+1
    else:
      print("NO")
      break
  if x==7:
    print("YES")

Submission status: Runtime Error

Solution code:
def my_index(l, x, default=0):
    if x in l:
        return l.index(x)
    else:
        return default


T=list("keyence")
x=0
j=0
S=input()
if my_index(S,"k")==0:
  for i in range(len(S)):
    if S[i]==T[j]:
      x=x+1
      j=j+1
    else:
      continue
  if x==7:
    print("YES")
  else:
    print("NO")
else:
  for i in range(int(my_index(S,"k")),int(my_index(S,"k"))+7):
    if S[i]==T[i]:
      x=x+1
    if x==7:
      print("YES")
    else:
      print("NO")

Submission status: Runtime Error

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

for i in range(len(s)):
    if s[i]==t[0]:
        t=t[1:]
if t=="":
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
s = list(input())
memory = 0
moku = list("keyence")
hantei = 0
ren = 0
for i in range(len(s)):
    if hantei >= 2:
        break
    if s[i] == moku[memory]:
        memory+=1
        if ren == 0 and i!=0:
            hantei+=1
        ren+=1
    else:
        ren = 0
if memory == 7:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
S=[i for i in list(input())];N=len(S);k=['k','e','y','e','n','c','e']
for d in range(N-6):
    for i in range(N-d+1):
        s=S[:i]+S[i+d:];if s==k:
            print('YES');quit()
print('NO')

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
a=str()
b=str()
k='keyence'
l='ecneyek'
for i in range(n):
  if a+s[i] in k:
    a+=s[i]
    j=i
  else:
    break
for i in range(6-j):
  if b+s[n-i-1] in l:
    b+=s[n-i-1]
  else:
    break
if a+b[::-1]==k or a==k or b[::-1]==k:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
import sys

s = input()
A = "keyence"

ind = 100

for i in range(len(s)):
	if i == 0:
		if s[i] == A[i]:
			continue
		else:
			ind = -1
			break

	if i == 6:
		if s[i] == A[i]:
			print("YES")
			sys.exit()

	else:
		if s[i] == A[i]:
			continue
		else:
			ind == i
			break

if ind == -1:
	print("NO")
	sys.exit()

ind_back = 100

for i in range(1,8):
	if i == 1:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == -1
			break

	if i == 7:
		if s[-i] == A[-i]:
			print("YES")
			sys.exit()

	else:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == 7-i+1

if ind == ind_back:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

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

count = 0
count2 = 0
flag = True

for i in s:
    if i == t[count]:
        count += 1
        flag = True
    else:
        if flag:
            count2 += 1
            flag = False
        else:
            pass

if count2 <= 1 and count == len(t):
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
s = input()

check = 0
re = 0
t = 'keyence'
len = 0
ans = 0
for i in s:
    if t[len] == i and len < 7:
        len += 1
        re = 0
    else:
        if check == 0:
            check = 1
            re = 1
        elif re == 1:
            tmp = 1
        else:
            ans = 1

if ans == 0 and len == 7:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d = collections.deque(list("keyence"))
    s = str(input().rstrip('\n'))
    for i in range(len(s)):
        if len(p) == 0:
            break
        else:
            p = d.popleft()
            if p != s[i]:
                d.appendleft(p)
    print("YES" if len(d) == 0 else "NO")


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d = collections.deque(list("keyence"))
    s = str(input().rstrip('\n'))
    for i in range(len(s)):
        p = d.popleft()
        if p != s[i]:
            d.appendleft(p)
    print("YES" if len(d) == 0 else "NO")


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
# B - KEYENCE String
S = input()
K = list('keyence')
count = 0
idx_k = 0
is_NG = False

for s in S:
    if K[idx_k]==s:
        if idx_k<7:
            idx_k += 1
        is_NG = False
    else:
        if not is_NG:
            count +=1
            is_NG = True
    
    if count>=2:
        break
  
if count<=1 and idx_k==7:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
# B - KEYENCE String
S = input()
K = list('keyence')
count = 0
idx_k = 0
is_NG = False

for s in S:
    if K[idx_k]==s:
        if is_NG == True:
            is_NG = False    
        idx_k += 1
    else:
        if is_NG == False:
            count +=1
            is_NG = True
  
if count<=1 and idx_k==7:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
fl = 0
for i in range(len(s)):
    for j in range(len(s)):
        if i <= j:
            tmp = s[:i] + s[j:]
            if tmp == "keyence":
                flg = 1
if flg == 1:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
s = input()
key = "keyence"
j = 0
counter = 0
judge = []
word = key[j]
for i in range(len(s)):
    if s[i] == key[j] and j != 7:
        j +=1
    else:
        judge.append(i)

for i in range(len(judge) - 1):
    if judge[i+1] - judge[i] > 1:
        counter +=1

if j == 7 and counter == 0:            
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
s = input()

keyence = 'keyence'
flag = 0
k_i = 0
en = ""
en_list = []

for i in range(len(s)):
    if s[i] == keyence[k_i]:
        k_i += 1
        flag = 1
        if en != "":
            en_list.append(en)
            en = ""
    else:
        en += s[i]

if len(en_list) <= 1 and flag:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
s = str(input())
n = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[k:] == "keyence":
      print("YES")
      exit()
print("NO")

Submission status: Runtime Error

Solution code:
s = str(input())
num = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[k:] == "keyence":
      print("YES")
      exit()
print("NO")

Submission status: Runtime Error

Solution code:
s = input()

ans = 'keyence'

for i in range(len(s)):
    if s[i]==ans[0]:
        ans=ans[1:]
if ans=='':
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

st = ""
i_w = 0
delete = []

for i in s:
    if i == w[i_w]:
        i_w += 1
        if not st == "":
            delete.append(st)
            st = ""
    else:
        st += i
else:
    if not st == "":
        delete.append(st)

if i_w == 7 and len(delete) <= 1:
    ans = "YES"
else:
    ans = "NO"
print(ans)

Submission status: Runtime Error

Solution code:
a=["k","e","y","e","n","c","e"]
s=input()

if a==s[:7] or a==s[-7:]:
  print("YES")
else:
  i=0
  sw=0
  while 1:
    if a[i]==s[i]:
      i+=1
    else:
      break
  while 1:
    if a[i]==s[-7+i]:
      i+=1
    else:
      sw=1
      break
    if i==7:
      break
  print("NO" if sw==1 else "YES")

Submission status: Runtime Error

Solution code:
N=list(map(int,input().split()))
print("YES" if len(set(N))==4 and (1 in N and 9 in N and 7 in N and 4 in N) else "NO")

Submission status: Runtime Error

Solution code:
from re import fullmatch
S = input()
_s = "keyence"
flag = False
for i in range(len(_s)):
    if fullmatch(f".*{_s[:i]}.*{_s[i:]}.*", S):
        flag = True
print("YES") if flag else print("NO")

Submission status: Runtime Error

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

ans = false
for i in range(N):
  for j in range(i,N):
    if S[:i]+S[j:] == "keyence":
      print("YES")
      ans = True
      break
  if ans: break
else:
  print("NO")

Submission status: Runtime Error

Solution code:
N=input()
flag = 0
l=ken(N)
if l != 7:
        for i in range(7):
                g=N[0:i]+N[i+l-7:l]
                if g=='keyence':flag=1
        if flag==1:print("YES")
        else :print("NO")
else if N=='keyence':print("YES")
else print("NO")

Submission status: Runtime Error

Solution code:
s=input()
if "k" in s and "y" in s and "n" in s and "c" in s and k.count("e")>=3:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x=input()
count=0
x_count=0
o=None
judge=[]
string=["k","e","y","e","n","c","e"]
for i in x:
    if(i==string[count] and count<=6):
        judge.append(i)
        count=count+1

for i in judge:        
    if(i==string[x_count]):
        o=True
        x_count=x_count+1
    else:
        x_count=x_count+1
        o=False
        break

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

Submission status: Runtime Error

Solution code:
x=input()
count=0
x_count=0
judge=[]
string=["k","e","y","e","n","c","e"]
for i in x:
    if(i==string[count] and count<=6):
        judge.append(i)
        count=count+1

for i in judge:        
    if(i==string[x_count]):
        o=True
        x_count=x_count+1
    else:
        x_count=x_count+1
        o=False
        break

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
k=list('keyence')
ans='NO'
cnt=[0]*n
final=0
j=0
for i in range(n):
    if j==n-1:
        break
    if s[i]==k[j]:
        cnt[i]=1
        j+=1
for i in range(n-1):
    if cnt[i]!=cnt[i+1]:
        final+=1
if cnt[0]==0 and final==1:
    ans='YES'
elif cnt[0]==1 and final==2:
    ans='YES'
if n==7 and final==0:
    ans='YES'
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
k=list('keyence')
ans='NO'
cnt=[0]*n
final=0
j=0
for i in range(n):
    if s[i]==k[j]:
        cnt[i]=1
        j+=1
for i in range(n-1):
    if cnt[i]!=cnt[i+1]:
        final+=1
if cnt[0]==0 and final==1:
    ans='YES'
elif cnt[0]==1 and final==2:
    ans='YES'
if n==7 and final==0:
    ans='YES'
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
pos=0
cnt=0
flag=False
check='keyence'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and cnt<=1:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
s=input()
pos=0
cnt=0
flag=False
check='keyence'
for i in range(len(s)):
  if s[i]==check[pos]:
    pos+=1
    flag=True
  else:
    if flag==True:
      cnt+=1
      flag=False
if pos==7 and flag<=1ju:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
a="keyence"
s=input()
ans=1
for i in range(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.rfind(n)
  if m==-1 or n==-1:
    continue
  if n-m>=len(m):
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Runtime Error

Solution code:
a="keyence"
s=input()
ans=1
for i in rangn(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.find(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNEOS"[ans::2])

Submission status: Runtime Error

Solution code:
a="keyence"
s=input()
ans=1
for i in rangn(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.find(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNeos"[ans::2])

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<set>
#include<string>
#include<cstring>
#include<fstream>
//#include<queue>
//#include<stack>
using namespace std;

int main()
{
	string s;
	const string target = "keyence";

	cin >> s;
	if (s == target) {
		cout << "YES" << endl;
		return 0;
	}
	int n = s.size();

	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			string t;
			for (int k = 0; k < n; k++) {
				if (i <= k && k < j)
					continue;
				t.push_back(s[k]);
			}
			if (t == target) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import re
l = list(re.findall(r"[c,e,k,n,y,]", aaa))
print(l)
if not(1<=l.count('k') and l.count('k')<=2):
    print("NO")
if not(3<=l.count('e') and l.count('k')<=4):
    print("NO")
if not(1<=l.count('y') and l.count('k')<=2):
    print("NO")
if not(1<=l.count('n') and l.count('k')<=2):
    print("NO")
if not(1<=l.count('c') and l.count('k')<=2):
    print("NO")
print("YES")

Submission status: Runtime Error

Solution code:
S = list(input())
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
le = len(S)
r = -1
l = -1
n = 0

for i in range(le):
    s = S[i]
    if s == key[n]:
        n += 1
    elif r == -1:
        r = i
    elif l == -1 or (l == i-1):
        l = i
    else:
        n = 0
        break
else:
    if n == 7:
        print("YES")
    else:
        print("NO")

Submission status: Runtime Error

Solution code:
S = list(input())
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
le = len(S)
r = -1
l = -1
n = 0

for i in range(le):
    s = S[i]
    if s == key[n]:
        n += 1
    elif r == -1:
        r = i
    elif l == -1 or l == i-1:
        l = i
    else:
        n = 0
        break
else:
    if n == 7:
        print("YES")
    else:
        print("NO")

Submission status: Runtime Error

Solution code:
S = list(input())
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
le = len(S)
r = -1
l = -1
n = 0

for i in range(le):
    s = S[i]
    if s == key[n]:
        n += 1
    elif r == -1:
        r = i
    elif l == -1 or l == i-1:
        l = i
else:
    if n == 7:
        print("YES")
    else:
        print("NO")

Submission status: Runtime Error

Solution code:
S = list(input())
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
le = len(S)
n = 0
r = -1
l = -1

for i in range(le):
    s = S[i]
    if s == key[n]:
        n += 1
    elif r == -1:
        r = i
    elif l == -1:
        l = i
    elif l == i - 1:
        l = i
    else:
        print("NO")
        break
else:
    if l == le - 1:
        print("NO")
    else:
        print("YES")

Submission status: Runtime Error

Solution code:
n = list(map(int, input().split()))

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")


S = list(input())
s1 = list("keyence")

x = [1]
y = [1]
for i in range(7):
  if S[i] == s1[i]:
    x.append(x[len(x)-1])
  else:
    x.append(0)
  if S[len(S)-1-i] == s1[6-i]:
    y.append(y[len(y)-1])
  else:
    x.append(0)

if sum(x) + sum(y) >= 9:
  print("YES")  
else:
  print("NO")

Submission status: Runtime Error

Solution code:
word = 'keyence'
l = input()
now = 0
start = False
for w in l:
  if word[now] == w:
    now += 1
  else:
    if start:
      return
    else:
      start = True
  if now == len(word):
    print('YES')
    exit()
print('NO')

Submission status: Runtime Error

Solution code:
word = 'keyence'
l = input()
now = 0
for w in l:
  if word[now] == w:
    now ++
  if now == len(word):
    print('YES')
    exit()
print('NO')

Submission status: Runtime Error

Solution code:
L = list(input())
A = list("keyence")

prev = -1
for i, a in A:
  curr = L.index(a)
  if prev < current:
    continue
  else:
    print("NO")
    exit()
print("YES")

Submission status: Runtime Error

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

x = [1]
y = [1]
for i in range(7):
  if S[i] == s1[i]:
    x.append(x[i])
  if S[len(S)-1-i] == s1[6-i]:
    y.append(y[i])
  

if sum(x) + sum(y) >= 9:
  print("YES")  
else:
  print("NO")

Submission status: Runtime Error

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

x = [1]
y = [1]
for i in range(7):
  if S[i] == s1[i]:
    x.append(x[i-1])
  if S[len(S)-1-i] == s1[6-i]:
    y.append(y[i-1])
  

if sum(x) + sum(y) >= 9:
  print("YES")  
else:
  print("NO")

Submission status: Runtime Error

Solution code:
S = list(input())
L = list('keyence')
if len(L) > len(S):
	print('NO')
else:
    while L[0] == S[0]:
        L = L[1:]
        S = S[1:]
    while len(L) != 0 and L[-1] == S[-1]:
        L = L[:-1]
        S = S[:-1]
    if L == []:
        print('YES')
    else:
        print('NO')

Submission status: Runtime Error

Solution code:
S = list(input())
L = list('keyence')
if len(L) > len(S):
	print('NO')
else:
	while L[0] == S[0]:
    	L = L[1:]
    	S = S[1:]
	while len(L) != 0 and L[-1] == S[-1]:
    	L = L[:-1]
    	S = S[:-1]
	if L == []:
    	print('YES')
	else:
    	print('NO')

Submission status: Runtime Error

Solution code:
S = list(input())
L = list('keyence')
while L[0] == S[0]:
    L = L[1:]
    S = S[1:]
while len(L)*len(S) != 0 and L[-1] == S[-1]:
    L = L[:-1]
    S = S[:-1]
if L == []:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
import re

regex1 = re.compile(.*keyence)
regex2 = re.compile(k.*eyence)
regex3 = re.compile(ke.*yence)
regex4 = re.compile(key.*ence)
regex5 = re.compile(keye.*nce)
regex6 = re.compile(keyen.*ce)
regex7 = re.compile(keyenc.*e)
regex8 = re.compile(keyence.*)

string = input()
match = re.findall(regex1, string)
match += re.findall(regex2, string)
match += re.findall(regex3, string)
match += re.findall(regex4, string)
match += re.findall(regex5, string)
match += re.findall(regex6, string)
match += re.findall(regex7, string)
match += re.findall(regex8, string)

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

Submission status: Runtime Error

Solution code:
s = input()
correct_count = 0
wrong_char_index_list = []

for i in range(len(s)):
    if s[i] == "keyence"[correct_count]:
        correct_count += 1
        if correct_count == len("keyence"):
            break
    else:
        wrong_char_index_list.append(i)

# 全部間違い
if len(wrong_char_index_list) == len(s):
    print("NO")
    exit()

# 間違い箇所が飛んでたらダメ
if len(wrong_char_index_list) >= 2:
    for i in range(1, len(wrong_char_index_list) + 1):
        if wrong_char_index_list[i] - wrong_char_index_list[i-1] != 1:
            print("NO")
            exit()

print("YES")
exit()

Submission status: Runtime Error

Solution code:
def solve():
  s=input()
  for l in range(len(s)):
    for r in range(l,len(s)):
      if "keyence" in a[:l]+a[r:]:
        print("YES")
        return
  print("NO")

solve()

Submission status: Runtime Error

Solution code:
from IPython import embed

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

Submission status: Runtime Error

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

for j in range(0, 8):
	if S[0:j] + S[L- 7 +j:] = "keyence":
		Truth = 1

if Truth =1:
	print(YES)
else:
	print(NO)

Submission status: Runtime Error

Solution code:
if S[0:7]=='keyence':
    OK = True
elif S[l-7:]=='keyence':
    OK = True
elif S[l-6:]=='eyence' and S[0]=='k':
    OK = True
elif S[l-5:]=='yence' and S[:2]=='ke':
    OK = True
elif S[l-4:]=='ence' and S[:3]=='key':
    OK = True
elif S[l-3:]=='nce' and S[:4]=='keye':
    OK = True
elif S[l-2:]=='ce' and S[:5]=='keyen':
    OK = True
elif S[l-1:]=='e' and S[:6]=='keyenc':
    OK = True
else:
    OK = False
print('YES' if OK else 'NO')

Submission status: Runtime Error

Solution code:
S = input()
n = False
for i in range(len(S) + 1):
    for j in range(i, len(S) + 1):
        rest_str = S[:i] + S[j:]
        if rest_str == keyence:
            n = True
            break
    if n:
        break
if n:
	print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
S = input()
 
keyence = "keyence"
 
isKey = False
for i in range(len(S) + 1):
    for j in range(i, len(S) + 1):
        rest_str = S[:i] + S[j:]
        if rest_str == keyence:
            isKey = True
            break
if isKey:
  pirnt('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
S = input()
#if 'keyence' in S: print("YES")
elif 'keyenc' in S and S.find('e',S.find('keyenc')+7)!=-1 :print("YES")
elif 'keyen' in S and S.find('ce',S.find('keyen')+6)!=-1 :print("YES")
elif 'keye' in S and S.find('nce',S.find('keye')+5)!=-1 :print("YES")
elif 'key' in S and S.find('ence',S.find('key')+4)!=-1 :print("YES")
elif 'ke' in S and S.find('yence',S.find('ke')+3)!=-1 :print("YES")
elif 'k' in S and S.find('eyence',S.find('k')+2)!=-1 :print("YES")
else : print("NO")

Submission status: Runtime Error

Solution code:
s = input()

str_ = "keyence"
a = [(str_[0:i], str_[i:]) for i in range(1, 7)]

flg = 0
for i, j in a:
    s1 = s.split(i)
    s2 = s1[1].split(j)
    
    if len(s2) >= 2:
        pass
    else:
        flg = 1
if flg == 1:
    print("YES")
elif s == "keyence":
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a = input()
s = ('k','e','y','e','n','c','e')
i = 0
for char in a:
    if char == s[i]:
        i += 1
if i == 7:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
# B_KEYENCE String

import sys

S = list(input())

key = ['k','e','y','e','n','c','e']
i = 0
ng = 0
flg1 = True
flg2 = True
for _ in range(len(S)) :
    if S[_] == key[i] :
        i += 1

if i > 6 :
    print("YES")
else :
    print("NO")

Submission status: Runtime Error

Solution code:

S = list(input())

str = ["k","e","y","e","n","c","e"]
false = 0
split = 0

for i in S :
    if i==str[0]:
        str.pop(0)
        if false > 0 :
            split += 1
            false = 0
    else:
        false += 1

if len(str)==0:
    if split <=1 :
        print("YES") 
    else :
        print("NO")
else :
    print("NO")

Submission status: Runtime Error

Solution code:
import re

if re.match("keyence",S) or re.match("^(.*)(keyence)$",S) or re.match("^k(.*)(eyence)$",S) or re.match("^(ke)(.*)(yence)$",S) or re.match("^(key)(.*)(ence)$",S) or re.match("^(keye)(.*)(nce)$",S) or re.match("^(keyen)(.*)(ce)$",S) or re.match("^(keyenc)(.*)(e)$",S)  or re.match("^(keyence)(.*)$",S):
    print("YES")
else:
    print("NO")