function Main(input) {
  input=input.replace("\n","");
  var b=0;
  var i=0;
  var counter=0;
  while(input[i]){
    if(input[i]==='B'){
      b++;
    }else{
      counter+=b;
    }
    i++;
  }
  console.log(counter);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
