Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main()
{
string s;
cin>>s;
bool flag=0;
if(s.length()>9)
{
flag=1;
}
else
{
for(int i=0;i<s.length();i++)
{
if(i<s.length()&&((s.substr(s.begin()+i,s.begin()+i+1)=="KA")||(s.substr(s.begin()+i,s.begin()+i+1)=="AI")||(s.substr(s.begin()+i,s.begin()+i+1) =="IA")||(s.substr(s.begin()+i,s.begin()+i+1) =="AH")))
{
flag=1;
break;
}
else if(s[i]=='A') s.erase(s.begin()+i);
}
}
if(flag) cout<<"NO"<<endl;
else if(s=="KIHBR") cout<<"YES"<<endl;
else cout<<"NO"<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:38: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   20 | if(i<s.length()&&((s.substr(s.begin()+i,s.begin()+i+1)=="KA")||(s.substr(s.begin()+i,s.begin()+i+1)=="AI")||(s.substr(s.begin()+i,s.begin()+i+1) =="IA")||(s.substr(s.begin()+i,s.begin()+i+1) =="AH")))
      |                             ~~~~~~~~~^~
      |                                      |
      |                                      __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 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/basic_string.h:3208:24: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |              ~~~~~~~~~~^~~~~~~~~
a.cc:20:83: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   20 | if(i<s.length()&&((s.substr(s.begin()+i,s.begin()+i+1)=="KA")||(s.substr(s.begin()+i,s.begin()+i+1)=="AI")||(s.substr(s.begin()+i,s.begin()+i+1) =="IA")||(s.substr(s.begin()+i,s.begin()+i+1) =="AH")))
      |                                                                          ~~~~~~~~~^~
      |                                                                                   |
      |                                                                                   __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >
/usr/include/c++/14/bits/basic_string.h:3208:24: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |              ~~~~~~~~~~^~~~~~~~~
a.cc:20:128: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   20 | if(i<s.length()&&((s.substr(s.begin()+i,s.begin()+i+1)=="KA")||(s.substr(s.begin()+i,s.begin()+i+1)=="AI")||(s.substr(s.begin()+i,s.begin()+i+1) =="IA")||(s.substr(s.begin()+i,s.begin()+i+1) =="AH")))
      |                                                                                                                       ~~~~~~~~~^~
      |                                                                                                                                |
      |                                                                                                                                __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >
/usr/include/c++/14/bits/basic_string.h:3208:24: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |              ~~~~~~~~~~^~~~~~~~~
a.cc:20:174: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   20 | if(i<s.length()&&((s.substr(s.begin()+i,s.begin()+i+1)=="KA")||(s.substr(s.begin()+i,s.begin()+i+1)=="AI")||(s.substr(s.begin()+i,s.begin()+i+1) =="IA")||(s.substr(s.begin()+i,s.begin()+i+1) =="AH")))
      |                                                                                                                                                                     ~~~~~~~~~^~
      |                                                                                                                                                                              |
      |                                                                                                                                                                              __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >
/usr/include/c++/14/bits/basic_string.h:3208:24: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |              ~~~~~~~~~~^~~~~~~~~