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

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

use std::cmp::min;
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let s:Vec<char> = read::<String>().chars().collect();
    let master:Vec<char> = "keyence".chars().collect();
    let mut index: usize = 0;
    let mut exist = false;
    for j in 0..s.len() {
        if s[j as usize] == master[index] {
            // println!("{}",index);
            if index == 6 {
                exist = true;
                break;
            }
            index += 1;
        } else {
            let sub = master.clone().into_iter().skip(index).collect::<String>();
            let t = s.clone().into_iter().skip(j).collect::<String>();
            // println!("{}",sub);
            // println!("{}",t);
            if t.contains(&sub) {
                exist = true;
                break;
            }
            index = 0;
        }
    }
    let ans  = if exist {
        "YES"
    } else {
        "NO"
    };
    println!("{}",ans);
}