#import <stdio.h>
int main(){
    char c;
    int b=0;
    int ans=0;
    while((c=getchar())!=EOF){
        if (c=='B') b++;
        else if (c=='W') ans+=b;
        else break;
    }
    printf("%d",ans);
}
