#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
   string s;cin>>s;
   int n = s.size();
   reverse(all(s));
   int cnt=0, res=0;
   rep(i,n){
       if(s[i]=='W')++cnt;
       else res+=cnt;
   }
   cout<<res<<endl;
}