#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string S; cin >> S;
	
	int cnt = 0, ans = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'B')cnt++;
		else ans += cnt;
	}

	cout << ans << endl;

    return 0;
}