#include <stdio.h>
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define ri(a) scanf("%d",&a)
#define rii(a,b) ri(a),ri(b)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) lri(a),lri(b)
#define all(x) x.begin(),x.end()
#define ms(obj,val) memset(obj,val,sizeof(obj))

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 1e9+7;
const int MAXN = 2e5+5;
char s[MAXN];
int main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	scanf("%s",s);
	ll ans = 0; int b = 0;
	FOR(i,0,(int)strlen(s)){
		if(s[i]=='B') b++;
		else ans += b;
	}
	printf("%lld\n",ans);
	return 0;
}
