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:
import re
l = list(re.findall(r"[c,e,k,n,y,]", input()))

flg=0
if not(1<=l.count('k') and l.count('k')<=2):
    print("NO")
    flg=1
elif not(3<=l.count('e') and l.count('k')<=4):
    print("NO")
    flg=1
elif not(1<=l.count('y') and l.count('k')<=2):
    print("NO")
    flg=1
elif not(1<=l.count('n') and l.count('k')<=2):
    print("NO")
    flg=1
elif not(1<=l.count('c') and l.count('k')<=2):
    print("NO")
    flg=1
else:
  print("YES")

Submission status: Wrong Answer

Solution code:
import re
l = list(re.findall(r"[c,e,k,n,y,]", input()))

flg=0
if not(1<=l.count('k') and l.count('k')<=2):
    print("NO")
    flg=1
if not(3<=l.count('e') and l.count('k')<=4):
    print("NO")
    flg=1
if not(1<=l.count('y') and l.count('k')<=2):
    print("NO")
    flg=1
if not(1<=l.count('n') and l.count('k')<=2):
    print("NO")
    flg=1
if not(1<=l.count('c') and l.count('k')<=2):
    print("NO")
    flg=1
if flg<1:
  print("YES")

Submission status: Wrong Answer

Solution code:
import re
l = list(re.findall(r"[c,e,k,n,y,]", input()))

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: Wrong Answer

Solution code:
import re
l = list(re.findall(r"[c,e,k,n,y,]", input()))
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: Wrong Answer

Solution code:
import sys
S = list(input())
Ans_list=['k','e','y','e','n','c','e']
Ans = 0
for i in range(len(S)):
    for j in range(i,len(S),+1):
        
        if (S[:i:]+S[j::]) == Ans_list:
           Ans = 1
           print(Ans)
           sys.exit()
print(Ans)

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer(data = None):
    """
    >>> output('keyence')
    YES
    >>> output('keyaaaaence')
    YES
    >>> output('keyaaeaance')
    NO
    >>> output('keyaenceaaaa')
    YES
    >>> output('aaaakeyence')
    YES
    >>> output('keyenceaaaa')
    YES
    >>> output('keyencaaaaa')
    NO
    >>> output('KEYENCE')
    NO
    >>> output('a')
    NO
    >>> output('')
    NO
    """
    if data:
        s = data
    else:
        s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    if n > 100:
        return False
    slide = 0
    for i in range(n):
        if k < len(k_list) and s[i] == k_list[k]:
            k += 1
        else:
            slide = i
            break
    return k_list[k:] in s[slide:]

def output(data = None):
    res = answer(data)
    if res:
        print('YES')
    else:
        print('NO')
output()

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer(data = None):
    if data:
        s = data
    else:
        s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    slide = 0
    for i in range(n):
        if k < len(k_list) and s[i] == k_list[k]:
            k += 1
        else:
            slide = i
            break
    return k_list[k:] in s[slide:]

def output(data = None):
    res = answer(data)
    if res:
        print('YES')
    else:
        print('NO')
output()

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer():
    s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    slide = 0
    for i in range(n):
        if s[i] == k_list[k]:
            k += 1
        else:
            slide = i
            break
        if k > len(k_list):
            return True
    return k_list[k:] in s[slide:]

res = answer()
if res:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer():
    s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    slide = 0
    for i in range(n):
        if s[i] == k_list[k]:
            k += 1
        if k > len(k_list):
            return True
        else:
            slide = i
            break
    return k_list[k:] in s[slide:]

res = answer()
if res:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys

target = input()
search_string = 'keyence'
split_index = 8
while 0 < split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.rfind(tail)
    # print('head: ' + str(find_index)  + ' : ' + head)
    # print('tail: ' + str(rfind_index) + ' : ' + tail)
    if head == '' and rfind_index != -1:
        print('YES')
        sys.exit()
    if tail == '' and find_index != -1:
        print('YES')
        sys.exit()
    if find_index == -1 or rfind_index == -1:
        continue
    if (find_index + split_index) <= rfind_index:
        print('YES')
        sys.exit()
print('NO')

Submission status: Wrong Answer

Solution code:
target = input()
search_string = 'keyence'
split_index = 8
while 0 < split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.rfind(tail)
    # print('head: ' + str(find_index)  + ' : ' + head)
    # print('tail: ' + str(rfind_index) + ' : ' + tail)
    if head == '' and rfind_index != -1:
        print('YES')
        exit()
    if tail == '' and find_index != 1:
        print('YES')
        exit()
    if find_index == -1 or rfind_index == -1:
        continue
    if (find_index + len(head)) <= rfind_index:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
target = input()
search_string = 'keyence'
split_index = 7
while 0 <= split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.rfind(tail)
    # print('head: ' + str(find_index)  + ' : ' + head)
    # print('tail: ' + str(rfind_index) + ' : ' + tail)
    if find_index == -1 or rfind_index == -1:
        continue
    if (find_index + len(head)) <= rfind_index:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer():
    s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    slide = 0
    for i in range(n):
        if s[i] == k_list[k]:
            k += 1
        if k > len(k_list):
            return True
        else:
            slide = i
            break
    return k_list[k:] in s[slide:]

res = answer()
if res:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
def data_input():
    a = input()
    return a
def answer():
    s = data_input()
    k_list = 'keyence'
    k = 0
    n = len(s)
    slide = 0
    for i in range(n):
        if s[i] == k_list[k]:
            k += 1
        else:
            slide = i
            break
    return k_list[k:] in s[slide:]

res = answer()
if res:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
target = input()
search_string = 'keyence'
split_index = 8
while 0 <= split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.rfind(tail)
    if find_index == -1 or rfind_index == -1:
        continue
    if find_index < rfind_index:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
target = input()
search_string = 'keyence'
split_index = 8
while 0 <= split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.find(tail)
    if find_index == -1 or rfind_index == -1:
        continue
    if find_index < rfind_index:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
import itertools
s=str(input())
n='keyence'
k=''
w=list(itertools.combinations(range(len(s)+1), 2))
print(w)
for i,y in w:
    k=s[i:y]
    ss=s.replace(k,'',1)
    print(ss)
    if ss==n or k==n:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
target = input()
search_string = 'keyence'
split_index = 8
while 0 < split_index:
    split_index -= 1
    head = search_string[0:split_index]
    tail = search_string[split_index:]
    find_index = target.find(head)
    rfind_index = target.find(tail)
    if find_index == -1 or rfind_index == -1:
        continue
    if find_index < rfind_index:
        print('YES')
        exit()
print('NO')

Submission status: Wrong Answer

Solution code:
s=input();
a='keyence'
flag=False
for i in range(len(a)):
  if (a[:i] in s) and (a[i:] in s) and s.count('e')>2:
    print("YES")
    flag=True
    break
if not flag:
  for i in range(1,len(a)-1):
    for j in range(i+1,len(a)):
      s1,s2,s3=a[:i],a[i:j],a[j:]
      if (s1+s3+s2 in s) or (s2+s1+s3 in s) or (s2+s3+s1 in s) or (s3+s1+s2 in s) or (s3+s2+s1 in s):
        print("YES")
        flag=True
        break
    if flag:
      break
  if not flag:
    print("NO")

Submission status: Wrong Answer

Solution code:
s=input();
a='keyence'
flag=False
for i in range(len(a)):
  if (a[:i] in s) and (a[i:] in s) and s.count('e')>2:
    print("YES")
    flag=True
    break
if not flag:
  print("NO")

Submission status: Wrong Answer

Solution code:
s=input();
a='keyence'
flag=False
for i in range(len(a)):
  if (a[:i] in s) and (a[i:] in s):
    print("YES")
    flag=True
    break
if not flag:
  print("NO")

Submission status: Wrong Answer

Solution code:
s=input();
a='keyence'
flag=False
for i in range(len(a)):
  if (a[:i] in s) and (a[i:] in s):
    print("YES")
    flag=True
if not flag:
  print("NO")

Submission status: Wrong Answer

Solution code:
ls=input()
i = 1
if (ls[:7] == 'keyence') or ls[-7:] == 'keyence':
  print('YES')
else:
  ls1 = ls[:4]
  ls2 = ls[-4:]
  if (ls1 == 'keye' and ls2[1:] =='nce') or (ls1[:3] == 'key' and ls2 == 'ence'):
    print('YES')
  else:
    print('NO')

Submission status: Wrong Answer

Solution code:
def checkInputPattern(inputList):
    a = 0
    b = 0
    c = 0
    d = 0
    e = 0
    for char in inputList:
        if(char == 'k'):
            a = 1
        elif(char == 'e' and b < 4):
            b += 1
        elif(char == 'y'):
            c = 1
        elif(char == 'n'):
            d = 1
        elif(char == 'c'):
            e = 1
    if(a == 1 and b == 3 and c == 1 and d == 1 and e == 1):
        return True
    else:
        return False

if __name__ == '__main__':
    inp = list(input())
    if checkInputPattern(inp):
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

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

CHECK_STRING = 'keyence'

def main():
  line = sys.stdin.readline().strip()

  CheckKeys = list(CHECK_STRING)
  checkChar = CheckKeys.pop(0)

  missIndex = 0
  for i in list(line):
    if i == checkChar:
      if len(CheckKeys) != 0:
        checkChar = CheckKeys.pop(0)
      else:
        print('YES')
        return
    else:
      break
    missIndex += 1

  restString = CHECK_STRING[missIndex:]
  checkRestString = line[missIndex:]

  secondIndex = checkRestString.find(restString)
  if secondIndex > -1 and checkRestString[secondIndex:] == restString:
    print('YES')
  else:
    print('NO')


main()

Submission status: Wrong Answer

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

CHECK_STRING = 'keyence'

def main():
  line = sys.stdin.readline().strip()

  CheckKeys = list(CHECK_STRING)
  checkChar = CheckKeys.pop(0)

  missIndex = 0
  for i in list(line):
    if i == checkChar:
      if len(CheckKeys) != 0:
        checkChar = CheckKeys.pop(0)
    else:
      break
    missIndex += 1

  restString = CHECK_STRING[missIndex:]
  checkRestString = line[missIndex:]

  secondIndex = checkRestString.find(restString)
  if secondIndex > -1 and checkRestString[secondIndex:] == restString:
    print('YES')
  else:
    print('NO')


main()

Submission status: Wrong Answer

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

CHECK_STRING = 'keyence'

def main():
    line = sys.stdin.readline().strip()

    CheckKeys = list(CHECK_STRING)
    checkChar = CheckKeys.pop(0)

    exceptionCount = 0
    lastMatch = True
    for i in list(line):
        if i == checkChar:
            if len(CheckKeys) != 0:
                checkChar = CheckKeys.pop(0)
        else:
            if lastMatch:
                exceptionCount += 1

        lastMatch = i == checkChar

    if len(CheckKeys) == 0 and exceptionCount <= 1:
        print('YES')
    else:
        print('NO')


main()

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
for i in t:
    c = s.find(i)
    if c == -1:
        break;
    s = s[c:]
if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
for i in t:
    c = s.find(t)
    if c == -1:
        break;
    s = s[c:]
if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(s)-1:
        c = -1
        break;
        if c!=0 :
            c+=1
    c = s.find(i,c)

if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(s)-1:
        c = -1
        break;
    c = s.find(i,c)

if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(s)-1:
        c = -1
        break;
    c+=1
    c = s.find(i,c)

if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(t)-1:
        c = -1
        break;
    c+=1
    c = s.find(i,c)

if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(t)-1:
        break;
    c+=1
    c = s.find(i,c)

if c == -1 or c == len(t)-1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    if c == -1 or c == len(t)-1:
        break;
    c+=1
    c = s.find(i,c)

if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    c = s.find(i,c)
    if c == -1:
        break;
    c+=1
if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = input()
t = "keyence"
c = 0
for i in t:
    c = s.find(i,c)
    if c == -1:
        break;
if c == -1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
s = 'aaaaaa' + input() + 'aaaaaa'
front_length = [0]*(len(s)-12)
front_max = 0
back_length = [0]*(len(s)-12)
back_max = 0
key = 'keyence'
for i in range(len(s)-12-1):
  for j in range(7,-1,-1):
    if s[6+i-j:6+i] == key[:j]:
      front_length[i] = max([front_max, j])
      front_max = max([front_max, j])
      break
for i in range(len(s)-12-1-1,-1,-1):
  for j in range(7,-1,-1):
    if s[6+i:6+i+j] == key[7-j:]:
      back_length[i] = max([back_max, j])
      back_max = max([back_max, j])
      break
back_length.insert(0,0)
front_length.append(0)
for i, j in zip(back_length, front_length):
  if i+j>=7:
    print('YES')
    break
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = 'aaaaaa' + input() + 'aaaaaa'
front_length = [0]*(len(s)-12)
front_max = 0
back_length = [0]*(len(s)-12)
back_max = 0
key = 'keyence'
for i in range(len(s)-12):
  for j in range(7,-1,-1):
    if s[6+i-j:6+i] == key[:j]:
      front_length[i] = max([front_max, j])
      front_max = max([front_max, j])
      break
for i in range(len(s)-12-1,-1,-1):
  for j in range(7,-1,-1):
    if s[6+i:6+i+j] == key[7-j:]:
      back_length[i] = max([back_max, j])
      back_max = max([back_max, j])
      break
back_length.insert(0,0)
front_length.append(0)
for i, j in zip(back_length, front_length):
  if i+j>=7:
    print('YES')
    break
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
s = 'aaaaaa' + input() + 'aaaaaa'
front_length = [0]*(len(s)-12)
front_max = 0
back_length = [0]*(len(s)-12)
back_max = 0
key = 'keyence'
for i in range(len(s)-12):
  for j in range(7,-1,-1):
    if s[6+i-j:6+i] == key[:j]:
      front_length[i] = max([front_max, j])
      front_max = max([front_max, j])
      break
for i in range(len(s)-12-1,-1,-1):
  for j in range(7,-1,-1):
    if s[6+i:6+i+j] == key[7-j:]:
      back_length[i] = max([back_max, j])
      back_max = max([back_max, j])
      break
for i, j in zip(back_length, front_length):
  if i+j>=7:
    print('YES')
    break
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
a=list(input())
b=list("keyence")
start=0

    
        

if a==b:
    print("YES")
    
else:
    b_riva=list(reversed(b))

    a_riva=list(reversed(a))
    end=0
    while True:
        if a[start]!=b[start]:
            break
        else:
            start+=1
    while True:
        if a_riva[end]!=b_riva[end]:
            break
        else:
            end-=1
    if a[0:start]+a[end:len(a)]==b:

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

Submission status: Wrong Answer

Solution code:
import re
chars = input()
ptns = {'[a-x]*keyence','k[a-x]*eyence','ke[a-x]*yence','key[a-x]*ence','keye[a-x]*nce','keyen[a-x]*ce','keyenc[a-x]*e','keyence[a-x]*'}

cnt = 0
for ptn in ptns:
  cnt = cnt + 1
  isPTN = re.match(ptn, chars) != None;
  if isPTN == True:
    print("YES")
    break

if cnt == 8:
	print("NO")

Submission status: Wrong Answer

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[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: Wrong Answer

Solution code:
word = 'keyence'
l = input()
i = l.find(word)
if i == 0 or i == (len(l)-len(word)) :
  print('YES')
  exit()

for i in range(1,len(word)):
  a = word[:i]
  b = word[i:]
  ai = l.find(a)
  bi = l.find(b)
  #print(ai,bi)
  if ai == 0 and bi == (len(l)-len(b)):
    print('YES')
    exit()
print('NO')

Submission status: Wrong Answer

Solution code:
word = 'keyence'
l = input()
if word in l:
  print('YES')
  exit()

for i in range(1,len(word)):
  a = word[:i]
  b = word[i:]
  ai = l.find(a)
  bi = l.find(b)
  #print(ai,bi)
  if ai == 0 and bi == (len(l)-len(b)):
    print('YES')
    exit()
print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if A == L:
  print("YES")
  exit()
if len(L) > len(A) + 1:
  print("NO")
  exit()
for i in range(len(L)):
  if A == L[0:i] + L[i:len(L)]:
    print("YES")
    exit()
print("NO")

Submission status: Wrong Answer

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

index = 0
prev = -1
for a in A:
    try:
      if 0 <= L[index:].index(a):
          index = index + L[index:].index(a) + 1
          continue
    except:
        print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
S = input()

ky = 'keyence'

lky = len(ky)
tf = [all({S[:i] == ky[:i], S[-(lky-i):] == ky[-(lky-i):]}) for i in range(lky)]

#for i in range(lky):
    # print(keyence[:i] + keyence[-(7-i):])
 
print(any(tf))

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0

str0 = re.compile(r'^' + key)
str1 = re.compile(r'' + key + '$')

if str0.search(s) != None or str1.search(s) != None:
  x = 1
else:
  for i in range(7):
    if x == 1:
      break
    str0 = re.compile(r'^' + key[i:])
    str1 = re.compile(r'' + key[-(6-i):] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0

str0 = re.compile(r'^' + key)
str1 = re.compile(r'' + key + '$')

if str0.search(s) != None or str1.search(s) != None:
  x = 1
else:
  for i in range(7):
    if x == 1:
      break
    str0 = re.compile(r'^' + key[i:])
    str1 = re.compile(r'' + key[:-(6-i)] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0

str0 = re.compile(r'^' + key)
str1 = re.compile(r'' + key + '$')

if str0.search(s) != None or str1.search(s) != None:
  x = 1
  print(str0.search(s))
  print(str1.search(s))
else:
  for i in range(7):
    str0 = re.compile(r'^' + key[i:])
    str1 = re.compile(r'' + key[:-(6-i)] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0

str0 = re.compile(r'^' + key)
str1 = re.compile(r'' + key + '$')
if str0.search(s) != None or str1.search(s) != None:
  x = 1
  print(str0.search(s))
  print(str1.search(s))
else:
  for i in range(7):
    str0 = re.compile(r'^' + key[i:])
    str1 = re.compile(r'' + key[:-(6-i)] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1
      print(str0.search(s))
      print(str1.search(s))

if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0
for i in range(7):
  str0 = re.compile(r'^' + key)
  str1 = re.compile(r'' + key + '$')
  if str0.search(s) != None or str1.search(s) != None:
    x = 1
  else:
    str0 = re.compile(r'^' + key[i])
    str1 = re.compile(r'' + key[6-i] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0
for i in range(7):
  str0 = re.compile(r'^' + key)
  str1 = re.compile(r'' + key + '$')
  if str0.search(s) != None or str1.search(s) != None:
    x = 1
  else:
    str0 = re.compile(r'^' + key[i])
    str1 = re.compile(r'' + key[6-i] + '$')
    if str0.search(s) != None and str1.search(s) != None:
      x = 1

if x == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import re

s = input()
key = 'keyence'
x = 0
for i in range(7):
  str0 = re.compile(r'^' + key[i])
  str1 = re.compile(r'' + key[6-i] + '$')
  if str0.search(s) != None and str1.search(s) != None:
    x = 1

if x == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

x = 0
z = [0]
for i in range(len(S)):
  if x <= 6:
    if S[i] == s1[x]:
      x += 1
      z.append(0)
    #elif x == 0:
    #  z.append(0)
    elif S[i-1] == S[i] and S[i] == s1[x-1] and sum(z) == 0:
      z.append(0)
    else:
      if z[i] == 1:
        z[i] = 0
        z.append(1)
      else:
        z.append(1)
  else:
    if len(S)-1 >= i:
      z.append(1)
      if i != 7:
        z[0] = 1
    break


if sum(z) <= 1 and x != 0:
  print("YES")  
else:
  print("NO")

Submission status: Wrong Answer

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

x = 0
z = [0]
for i in range(len(S)):
  if x <= 6:
    if S[i] == s1[x]:
      x += 1
      z.append(0)
    #elif x == 0:
    #  z.append(0)
    elif S[i-1] == S[i] and S[i] == s1[x-1] and sum(z) == 0:
      z.append(0)
    else:
      if z[i] == 1:
        z[i] = 0
        z.append(1)
      else:
        z.append(1)
  else:
    if len(S)-1 >= i:
      z.append(1)
    break


if sum(z) <= 1 and x != 0:
  print("YES")  
else:
  print("NO")

Submission status: Wrong Answer

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

x = 0
z = [0]
for i in range(len(S)):
  if x <= 6:
    if S[i] == s1[x]:
      x += 1
      z.append(0)
    #elif x == 0:
    #  z.append(0)
    elif S[i-1] == S[i] and S[i] == s1[x-1] and sum(z) == 0:
      z.append(0)
    else:
      if z[i] == 1:
        z[i] = 0
        z.append(1)
      else:
        z.append(1)
  else:
    break


if sum(z) <= 1 and x != 0:
  print("YES")  
else:
  print("NO")

Submission status: Wrong Answer

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

x = 0
z = [0]
for i in range(len(S)):
  if x <= 6:
    if S[i] == s1[x]:
      x += 1
      z.append(0)
    elif x == 0:
      z.append(0)
    elif S[i-1] == S[i] and S[i] == s1[x-1]:
      z.append(0)
    else:
      if z[i] == 1:
        z[i] = 0
        z.append(1)
      else:
        z.append(1)
  else:
    break


if sum(z) <= 1 and x != 0:
  print("YES")  
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
import re

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

Submission status: Wrong Answer

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_KeyencePrograming_Contest-B
#  TODO https://keyence2019.contest.atcoder.jp/tasks/keyence2019_b
import re

def solveProblem(inputStr):
	pattern1 = r".*keyence"
	pattern2 = r"k.*eyence"
	pattern3 = r"ke.*yence"
	pattern4 = r"key.*ence"
	pattern5 = r"keye.*nce"
	pattern6 = r"keyen.*ce"
	pattern7 = r"keyenc.*e"
	pattern8 = r"keyence.*"
	matchOB1 = re.search(pattern1,inputStr)
	matchOB2 = re.search(pattern2,inputStr)
	matchOB3 = re.search(pattern3,inputStr)
	matchOB4 = re.search(pattern4,inputStr)
	matchOB5 = re.search(pattern5,inputStr)
	matchOB6 = re.search(pattern6,inputStr)
	matchOB7 = re.search(pattern7,inputStr)
	matchOB8 = re.search(pattern8,inputStr)
	if matchOB1 != None:
		return "YES"
	if matchOB2 != None:
		return "YES"
	if matchOB3 != None:
		return "YES"
	if matchOB4 != None:
		return "YES"
	if matchOB5 != None:
		return "YES"
	if matchOB6 != None:
		return "Yes"
	if matchOB7 != None:
		return "YES"
	if matchOB8 != None:
		return "YES"
	return "NO"


if __name__ == '__main__':
	S = input().strip()
	solution = solveProblem(S)
	print("{}".format(solution))

Submission status: Wrong Answer

Solution code:
s = input()
match_count = 0
match_string = "keyence"
deprecate_count = 0
deprecate_status = 0
ans = False
for i in s:
    if i == match_string[match_count]:
        deprecate_status = 1
        match_count += 1
        if match_count == len(match_string):
            ans = True
            break
    else:
        if deprecate_status == 1:
            deprecate_status = 2
            deprecate_count += 1
if ans and deprecate_count <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
match_count = 0
match_string = "keyence"
deprecate_count = 0
deprecate_status = False
ans = False
for i in s:
    if i == match_string[match_count]:
        deprecate_status = False
        match_count += 1
        if match_count == len(match_string):
            ans = True
            break
    else:
        if deprecate_status == False:
            deprecate_status = True
            deprecate_count += 1
if ans and deprecate_count <= 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
match_count = 0
match_string = "keyence"
deprecate_count = 0
deprecate_status = False
ans = False
for i in s:
    if i == match_string[match_count]:
        deprecate_status = False
        match_count += 1
        if match_count == len(match_string):
            ans = True
            break
    else:
        if deprecate_status == False:
            deprecate_status = True
            deprecate_count += 1
        if deprecate_count >= 2:
            ans = False
            break
if ans:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import re

S = input()

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

flg = False
for r in reg:
  if re.search(r, S):
    flg = True

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

Submission status: Wrong Answer

Solution code:
def is_keyence(s):
    KEYENCE = "keyence"
    if s[:7] == KEYENCE or s[-7:] == KEYENCE:
        return True
    for index, string in enumerate(KEYENCE):
        if s[:index] == KEYENCE[:index] and s[-index:] == KEYENCE[-index:]:
            return True
    return False

inp = input()
if is_keyence(inp):
    print("YES")
else:
    print("NO")