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