#include #define rep(i,n) for(int i = 0;i> n; string s; cin >> s; int ans = 0; bool bx = false; bool bb = false; rep(i,n-1){ string t = s; if(bx and s[i+1] == 'B') { bx = s[i] =='B'; continue; } bx = s[i] =='B'; if(s[i] == 'B' and s[i+1] == 'B') { bb = true; continue; } ans++; } if(bb) ans++; cout << ans << endl; return 0; }