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

int main() {
    string s;
    cin >> s;
    long long ans = 0, cur = 0;
    for (char ch : s) {
        if (ch == 'W') ans += cur;
        else cur++;
    }
    cout << ans << endl;
    return 0;
}