#include <bits/stdc++.h>

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)

typedef long long ll;

int main() {
    string s; cin >> s;
    ll r = 0;
    int a = 0;
    fore(i, 0, s.size()) {
        if(s[i] == 'W') r += i - a++;
    }
    cout << r << endl;
    return 0;
}