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 C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include "stdio.h"
#include "iostream"
#include "vector"
#include "algorithm"
#include "iomanip"
#include "map"
#include "set"
#include "bitset"
#include "queue"
#include "string.h"
#include "math.h"
#include "numeric"

using namespace std;
using LL = long long;


int main() {
    string s;
    cin >> s;

    string z = "keyence";
    int a = 0, b = 6, aa = 0, bb = s.size() - 1;
    int x = 0, c = 0;

    while (a <= b) {
        if (a < 7 and bb < (int) s.size() and z[a] == s[aa]) a++, aa++, c++;
        if (b >= 0 and bb >= 0 and z[b] == s[bb]) b--, bb--, c++;
        x ++;
        if (c >= 7) break;
        if (x >= 10) return !printf("NO");
    }

    puts("YES");
}