#include #define rep(i,a,n) for (int i = a;i < n;i++) using namespace std; int main() { int a=0,c=0; string s; cin >> s; rep(i,0,s.size()){ if(s[i] == 'B')c++; else a += c; } cout << a << endl; }