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: Accepted)

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: &str = iterator.next().unwrap();

    if s.starts_with("keyence")
        || s.starts_with("keyenc") && s.ends_with("e")
        || s.starts_with("keyen") && s.ends_with("ce")
        || s.starts_with("keye") && s.ends_with("nce")
        || s.starts_with("key") && s.ends_with("ence")
        || s.starts_with("ke") && s.ends_with("yence")
        || s.starts_with("k") && s.ends_with("eyence")
        || s.ends_with("keyence")
    {
        return String::from("YES");
    }

    return String::from("NO");
}