#include <bits/stdc++.h>

#define pb push_back
#define tam 1234567
#define offset 1020000
#define se second
#define fi first
#define pitem item*
#define ptr tre*
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000007 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
typedef vector<vector<ll> > vvi;
typedef long double lldb;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	string txt;
	cin>>txt;
	ll tot=0,numW=0;
	forr(i,0,txt.size())
	{
		if (txt[i]=='W')
		{
			tot+=i-numW;
			numW++;
		}
	}
	cout<<tot<<endl;
	return 0;
}