#include <bits/stdc++.h>
using namespace std;
#define fore_(i, s, e) for(long long i = s; i > e; i--)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef long long ll;
ll b,w,r;
string s;
int main() {
  FIN;cin>>s;
  fore_(i,s.size()-1,-1){
    if(s[i]-'W'){b++;r+=w;}else {w++;}
  }
  cout<<r<<endl;
  return 0;
}