#include #include #include #include using namespace std; int kr,kb; string s; int res=0; int sz; vector now; void backtrack(int n){ if(n==sz){ res=max(res,(int)now.size()); } else{ int m=(int)now.size(); now.push_back(s[n]); if(s[n]=='R'){ if(kr>m||now[m-kr]!='R'){ backtrack(n+1); } } else if(s[n]=='B'){ if(kb>m||now[m-kb]!='B') backtrack(n+1); } else backtrack(n+1); now.pop_back(); backtrack(n+1); } } int main(){ cin>>kr>>kb>>s; sz=(int)s.size(); now.reserve(sz); backtrack(0); cout<