#include<bits/stdc++.h>
using namespace std;
string s;
long long count_b,res;
int main(){
  cin>>s;
  for(auto e : s){
    if(e=='B'){
      count_b++;
    }else{
      res+=count_b;
    }
  }
  cout<<res;
}