#include<cstdio>
#include<cstring>
using namespace std;
char in[200005];
int n,a;
long long ans;
int main()
{
	scanf("%s",in+1);n=strlen(in+1);
	for(int i=n;i;--i) 
		if(in[i]=='W') a++;
		else ans+=a;
	printf("%lld",ans);
	return 0;
}