function main(input){
    lines = input.split("");

    var count=0;
    var cou=0;
    var t = lines.length;
    for(var i=0;i<t;i++){
        var a=lines[i];
        if(a=="W" && i==0){
            lines.splice(i,1);
            t--;
            i-=1;
            continue;
        }else if(a=="W"){
            count+=cou;
            lines[i]="B";
            lines.splice(i-cou,1);
            t--;
            i-=1;
            continue;
        }else{cou++;}
    }

    console.log(count);
}

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