#include <bits/stdc++.h>
using namespace std;
typedef long long intl;
int main(){
	string s;
	cin>>s;
	intl n=s.size();
	intl ans=0;
	intl where=n-1;
	for(intl i=n-1;i>=0;i--){
		if(s[i]=='B'){
			ans+=(where-i);
			where--;
		}	
	}
	cout<<ans<<endl;
}
