console.log((args=>{
  const S = args.trim();
  const N = S.length;
  let b = 0, f = 0;
  for ( let i = 0; i < N; i++ ) {
    if ( S[i] === 'B' ) b++;
    else f += b;
  }
  return `${f}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
