#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
  ll count=0,c=0;
  string cad;
  cin>>cad;
  bool canFound=true;
  while(canFound){
    c=0;
    for(ll i = 0 ; i < cad.length()-1; i++){
      if(cad[i]=='B' && cad[i+1]=='W'){
        c++;
      }
    }
    if(c==0){
      canFound=false;
      break;
    }else{
      for(ll i = cad.length()-1 ; i>0 ; i--){
        if(cad[i]=='W' && cad[i-1]=='B')
        {
          swap(cad[i],cad[i-1]);
          count++;
        }
      }
    }
  }
  cout<<count<<endl;
}
