#include <iostream>
using ll = long long;
int main()
{
  std::string S;std::cin >> S;
  ll ans = 0;
  for(int i = 0, d =0; i < S.size(); i++){
  	if(S[i]=='W'){ans += i-d,d++;}
  }
  std::cout << ans << std::endl;
  return 0;
}