import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main() {
  string s = readln.strip;
  long sm = 0, cnt = 0;
  foreach(i,c;s) if(c == 'W')
    sm += i - cnt++;
  writeln(sm);
}
