#include "bits/stdc++.h"
using namespace std;

int main() {
	long long count = 0, ans = 0;
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'W') {
			ans += i - count;
			count++;
		}
	}
	cout << ans;
}