#include<bits/stdc++.h>
using namespace std;
int B;
long long	answer;
string S;
int main(){
 cin >> S;
 for(int i = 0; i < S.size(); i++){
	if(S[i] == 'B') B++;
	else answer += B;
 }
 cout << answer << endl;
 return 0; 
};
