#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int Kr,Kb; cin >> Kr >> Kb; string s; cin >> s; vector RB; for(int i=0; i<30; i++) if(s.at(i) != 'W') RB.push_back(i); int n2 = 1<<20,n = 20,answer = 10; for(int S=0; S= siz) continue; vector NG(30); string now = ""; for(int i=0; i= 0 && now.at(check) == 'B') ok = false; check = i+Kb; if(check < siz && now.at(check) == 'B') ok = false; } else{ int check = i-Kr; if(check >= 0 && now.at(check) == 'R') ok = false; check = i+Kr; if(check < siz && now.at(check) == 'R') ok = false; } if(!ok) break; } if(ok) answer = max(answer,siz); } cout << answer << endl; }