process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => {
  console.log(countRevasible(input));
  process.exit(0) // プロセス終了
});

/**
 * @param {string} str input
 */
function countRevasible(str) {
  const arry = str.split("");
  let count = 0;
  let sum = 0;
  arry.map(c => {
    if (c === 'B') {
      count += 1;
    } else { // 'W'
      sum += count;
    }
  });
  return count.toString();
}