#include <iostream>
#include <string>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >>s;
  ll ss=s.size(),ans=0,bs=0;
  for(ll i=0;i<ss;i++){
   if(s[i]=='B') bs++;
   else ans+=bs;
  }
  cout <<ans<<endl;
}
