Language: C++

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s,w="AKIHABARA";

int main(){
	cin >> s;
	
	int c=0,cou=0; bool f=true;
	while(1){
		if(s[cou]==w[c]) c++,cou++;
		else if(s[cou]!=w[c] and w[c]=='A') c++;
		else if(s[cou]!=w[c]) f=false,cou=s.size();
		
		if(max(c,cou)==s.size()) break;
	}
	
	cout << (f?"YES":"NO") << endl;
	return 0;
}
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s,w="AKIHABARA";

int main(){
	cin >> s;
	
	int c=0,cou=0; bool f=true;
	while(1){
		if(s[cou]==w[c]) c++,cou++;
		else if(s[cou]!=w[c] and w[c]=='A') c++;
		else if(s[cou]!=w[c]) f=false,cou=s.size();
		
		if(max(c,cou)==s.size()) break;
	}
	
	cout << (f?"YES":"NO") << endl;
	return 0;
}


Compiler output:
a.cc:39:11: error: redefinition of 'const int INF'
   39 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |           ^~~
a.cc:10:11: note: 'const int INF' previously defined here
   10 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |           ^~~
a.cc:39:20: error: redefinition of 'const int MOD'
   39 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |                    ^~~
a.cc:10:20: note: 'const int MOD' previously defined here
   10 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |                    ^~~
a.cc:39:31: error: redefinition of 'const int around []'
   39 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |                               ^~~~~~
a.cc:10:31: note: 'const int around [10]' previously defined here
   10 | const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
      |                               ^~~~~~
a.cc:40:10: error: redefinition of 'const ll LINF'
   40 | const ll LINF=1e18;
      |          ^~~~
a.cc:11:10: note: 'const ll LINF' previously defined here
   11 | const ll LINF=1e18;
      |          ^~~~
a.cc:41:10: error: redefinition of 'const ld PI'
   41 | const ld PI=abs(acos(-1));
      |          ^~
a.cc:12:10: note: 'const ld PI' previously defined here
   12 | const ld PI=abs(acos(-1));
      |          ^~
a.cc:42:8: error: redefinition of 'std::string s'
   42 | string s,w="AKIHABARA";
      |        ^
a.cc:13:8: note: 'std::string s' previously declared here
   13 | string s,w="AKIHABARA";
      |        ^
a.cc:42:10: error: redefinition of 'std::string w'
   42 | string s,w="AKIHABARA";
      |          ^
a.cc:13:10: note: 'std::string w' previously declared here
   13 | string s,w="AKIHABARA";
      |          ^
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main(){
      |     ^~~~
a.cc:15:5: note: 'int main()' previously defined here
   15 | int main(){
      |     ^~~~