function main(arg) {
    var S = arg.split("");
    var cnt = 0;
    var whiteCnt = 0;
    var firstFlg = true;
    var localCnt = 0;
    var doneWhite = 0;
    var islastB;
    
    for(var i = 0 ; i < S.length; i++) {

        if(S[i] == "W") {
            doneWhite++;
            islastB = false;
            continue;
        }
        
        if(firstFlg) {
            for(var j = 1 ; j < S.length-i ;j++) {
                if( S[i+j] == "B") {
                    continue;
                }
            
                if( S[i+j] == "W" ) {
                    whiteCnt++;
                }
            }
        }

        cnt = cnt + whiteCnt - doneWhite;
        
        islastB = true;
        firstFlg = false;
    }
    
    console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));