#include <bits/stdc++.h>
#define ll long long
#define forit(it,a) for(auto it=(a).begin();it!=(a).end();it++)
#define forC(v) for(auto it = (v).begin();it!=(v).end();it++)cout << *it << " "
#define forM(v) for(auto it = (v).begin();it!=(v).end();it++)cout << it->second << " "
#define fori(i,n) for(auto i = 0 ; i < (n) ; i++)
#define endl "\n"
#define pll pair<ll,ll>

using namespace std;



int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//freopen("TEXT.txt","r",stdin);
	string  A;
	cin >> A ;
	ll cont=0;
	ll rta = 0;
	fori(i,A.length()){
		if(A[i]=='B')cont++;
		else rta+=cont;
	}
	cout << rta << endl;
	return 0;
}