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