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

// Last Change: 01/14/2019 00:03:45.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}

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

  const string key = "keyence";

  const int size = key.size();
  string subF, subB;
  for (int i = 1; i <= size; i++) {
    subF = key.substr(0, i);
    subB = key.substr(i, size - i);
    int pos = S.find(subF);
    if (pos != -1) {
      int pos2 = S.find(subB, pos + i);
      if (pos2 != -1) {
        cout << "YES" << endl;
        // cout << subF << ' ' << subB << endl;
        // cout << pos << ' ' << pos2 << endl;
        // LoopUntilZeroInpput();
        return 0;
      }
      // cout << subF << ' ' << subB << endl;
      // cout << pos << ' ' << pos2 << endl;
    }
  }

  cout << "NO" << endl;
  // LoopUntilZeroInpput();
  return 0;
}