#include <bits/stdc++.h>
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fore(i,j,k) for(unsigned int i=j;i<k;i++)
#define mm(a,b) memset(a,b,sizeof(a))
#define SZ(n) ((int) (n).size())
#define ALL(s) s.begin(),s.end()
#define bs binary_search
#define mp make_pair
#define pb push_back
#define snd second
#define fst first
typedef long double ld;
typedef long long ll;
using namespace std;
const ll M = 1e9+7;
const ll INF = 1e16;
const ll MAXN = 1000000000;

int main(){
	FIN;
	string s;
	cin>>s;
	ll black = 0;
	ll res=0;
	fore(i,0,s.size()){
		if (s[i] == 'B') black+=1;
		else res+=black;
	}
	cout<< res;
	return 0;
}