#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
using namespace std;
long long n,i,s,ss;
char c;
int main()
{
	while (cin>>c)
	{
		if (c=='W') ss+=s;else s++;
	}
	cout<<ss<<endl;
	return 0;
}