function Main(input) {
  var BW=/BW/;
  var counter=0;
  function operation(){
    if(BW.test(input)){
      input=input.replace(BW,'WB');
      counter++;
      return true;
    }
    console.log(counter);
    return false;   
  }
  while(operation()){};
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
