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