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