import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto S = readln.chomp;
    auto N = S.length.to!int;

    long ans = 0;
    long w = 0;

    foreach_reverse (i; 0..N) {
        if (S[i] == 'W') {
            w += 1;
        } else {
            ans += w;
        }
    }

    ans.writeln;
}
