import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(string s) {
    long ans = 0;
    int w = 0;
    for (int i = cast(int) s.length - 1; i >= 0; i--) {
        if (s[i] == 'W') w++;
        else if (s[i] == 'B') {
            ans += w;
        }
    }
    return ans;
}

void main() {
    string s = read!string;
    writeln(calc(s));
}
