function main(arg) {
    var S = arg.split("");
    var cnt = 0;
    
    for(var i = 0 ; i < S.length; i++) {
        if(S[i] == "W") {
            continue;
        }
        for(var j = 1 ; j < S.length-i ;j++) {
            if( S[i+j] == "W" ) {
                cnt++;
            }   
        }
    }
    
    console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));