Language: C++

#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

bool is_keyence(const string& s)
{
  string keyence = "keyence";
  if (keyence == s) return true;
  auto pos = s.find(keyence);
  if (pos == 0 or pos == s.size() - keyence.size()) return true;
  size_t begin = 0;
  for (; s[begin] == keyence[begin]; ++begin);
  size_t end = s.size() - 1;
  for (size_t i = keyence.size() - 1; s[end] == keyence[i]; --end, --i);
  return begin + (s.size() - 1 - end) >= keyence.size();
}

int main()
{
  string s;
  cin >> s;
  cout << (is_keyence(s) ? "YES" : "NO") << endl;
  return 0;
}

Compiler output:
a.cc:8:23: error: 'string' does not name a type
    8 | bool is_keyence(const string& s)
      |                       ^~~~~~
a.cc: In function 'bool is_keyence(const int&)':
a.cc:10:3: error: 'string' was not declared in this scope
   10 |   string keyence = "keyence";
      |   ^~~~~~
a.cc:5:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    4 | #include <algorithm>
  +++ |+#include <string>
    5 | 
a.cc:11:7: error: 'keyence' was not declared in this scope; did you mean 'is_keyence'?
   11 |   if (keyence == s) return true;
      |       ^~~~~~~
      |       is_keyence
a.cc:12:16: error: request for member 'find' in 's', which is of non-class type 'const int'
   12 |   auto pos = s.find(keyence);
      |                ^~~~
a.cc:12:21: error: 'keyence' was not declared in this scope; did you mean 'is_keyence'?
   12 |   auto pos = s.find(keyence);
      |                     ^~~~~~~
      |                     is_keyence
a.cc:13:28: error: request for member 'size' in 's', which is of non-class type 'const int'
   13 |   if (pos == 0 or pos == s.size() - keyence.size()) return true;
      |                            ^~~~
a.cc:15:11: error: invalid types 'const int[size_t {aka long unsigned int}]' for array subscript
   15 |   for (; s[begin] == keyence[begin]; ++begin);
      |           ^
a.cc:16:18: error: request for member 'size' in 's', which is of non-class type 'const int'
   16 |   size_t end = s.size() - 1;
      |                  ^~~~
a.cc:17:40: error: invalid types 'const int[size_t {aka long unsigned int}]' for array subscript
   17 |   for (size_t i = keyence.size() - 1; s[end] == keyence[i]; --end, --i);
      |                                        ^
a.cc:18:21: error: request for member 'size' in 's', which is of non-class type 'const int'
   18 |   return begin + (s.size() - 1 - end) >= keyence.size();
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:23:3: error: 'string' was not declared in this scope
   23 |   string s;
      |   ^~~~~~
a.cc:23:3: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:24:3: error: 'cin' was not declared in this scope
   24 |   cin >> s;
      |   ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <algorithm>
  +++ |+#include <iostream>
    5 | 
a.cc:24:10: error: 's' was not declared in this scope
   24 |   cin >> s;
      |          ^
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout << (is_keyence(s) ? "YES" : "NO") << endl;
      |   ^~~~
a.cc:25:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:45: error: 'endl' was not declared in this scope
   25 |   cout << (is_keyence(s) ? "YES" : "NO") << endl;
      |                                             ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <algorithm>
  +++ |+#include <ostream>
    5 |