Language: C++

#include <iostream>
using namespace std;

int main(){
  string S;
  cin >> S;
  int l;
  string m;
  m = "keyence";
  int c,k;
  c=0;
  k=0;
  m=1;
  f=0;
  string ans;
  ans = "NO";
  l = S.size();
  for(long i=0; i<l; i++){
    if (S[i]==m[c]){
      c++;
      cout<<i;
      if(f=1 & m=0){
        k++;
      }
      m=1;
      f=1;
    }
    else{
      m=0;
    }
    if(c==7&k<2){
      ans = "YES";
      break;
    }
  }
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'f' was not declared in this scope
   14 |   f=0;
      |   ^
a.cc:22:14: error: no match for 'operator&' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   22 |       if(f=1 & m=0){
      |            ~ ^ ~
      |            |   |
      |            int std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)'
   84 |   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:84:46: note:   no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Fmtflags'
   84 |   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |                                ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)'
  134 |   operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:134:46: note:   no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Openmode'
  134 |   operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |                                ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)'
  181 |   operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:181:44: note:   no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Iostate'
  181 |   operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |                               ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)'
  141 |   operator&(byte __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:141:18: note:   no known conversion for argument 1 from 'int' to 'std::byte'
  141 |   operator&(byte __l, byte __r) noexcept
      |             ~~~~~^~~
a.cc:29:9: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   29 |       m=0;
      |         ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  817 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  828 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  840 |       operator=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  858 |       operator=(basic_string&& __str)
      |       ^~~~~~~~