#include using namespace std; int main(void) { int Kr, Kb; cin >> Kr >> Kb; string S; cin >> S; auto dfs = [&](auto &&dfs, string s, int i) ->int { int M = s.size(); if(i == 30) return M; if(S[i] == 'W') return dfs(dfs, s + 'W', i + 1); int ans = dfs(dfs, s, i + 1); if(S[i] == 'R' and (M - Kr < 0 or s[M - Kr] != 'R')) ans = max(ans, dfs(dfs, s + 'R', i + 1)); if(S[i] == 'B' and (M - Kb < 0 or s[M - Kb] != 'B')) ans = max(ans, dfs(dfs, s + 'B', i + 1)); return ans; }; cout << dfs(dfs, "", 0) << endl; return 0; }