function main(input) {
    const args = input.split(' ');
    const Stones = args[0].toString();

    var count_B = 0;
    var ans = 0;

    for(var i = 0; i < Stones.length; i++) {
        if (Stones.charAt(i) === 'B') {
            count_B++;
        }
        else {
            ans += count_B;
        }
    }

    console.log(ans);

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
