/**
 * @param {string} str input
 */
function countRevasible(str) {
  const arry = str.replace("\n", "");
  let count = 0;
  let sum = 0;
  arry.map(c => {
    if (c === 'B') {
      count += 1;
    } else { // 'W'
      sum += count;
    }
  });
  console.log(sum);
}

countRevasible(require("fs").readFileSync("/dev/stdin", "utf8"));
