#ifdef LOCAL
//#include "rang.hpp"
//using namespace rang;
#endif
#pragma GGC optimize("Ofast") // Ofast 等效于 -O3 -ffast-math
#include <bits/stdc++.h>

using namespace std;

#define FAST_READ ios::sync_with_stdio(false); cin.tie(nullptr);
#ifdef LOCAL
#define see(x) cout  <<"<DBG> " << #x << ": " << (x) << endl
#endif
#ifndef LOCAL
#define see(x)
#endif

template<typename T> void dprintln(const T &t) { cout << t << endl; } // for debug use
template<typename T, typename ...Args> void dprintln(const T &t, const Args &...rest) { cout << t << ' '; dprintln(rest...); }
template<typename T> void println(const T &t) { cout << t << '\n'; }
template<typename T, typename ...Args> void println(const T &t, const Args &...rest) { cout << t << ' '; println(rest...); }

template<typename T> void print(const T &t) { cout << t << ' '; }

template<typename T, typename ...Args> void print(const T &t, const Args &...rest) { cout << t; print(rest...); }

// this overload is chosen when there's only one argument
template<class T> void scan(T &t) { cin >> t; }
template<class T, class ...Args> void scan(T &a, Args &...rest) { cin >> a; scan(rest...); }
using ll = long long;
using vl = vector<ll>;
using vi = vector<int>;
using pii = pair<int,int>;
using vb = vector<bool>;
using vpii = vector<pii>;

#define rng(i, a, b) for(int i = (a); i < (b); ++i)
#define down(i, b, a) for (int i = (b); i >= (a); i--)
#define rep(n) for(int _ = 0, __ = (int)n; _ < __; _++)
#define stp(i, a, b, c) for (int i = (a); i < (b); i += (c))
#define FOR(x, cont) for (auto &x: cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define SZ(x) (int)(x).size()
#define pq(T,COMP) priority_queue<T, vector<T>, COMP>
#define popcnt(x) __builtin_popcount((x))
#define SET(arr, v) memset(arr, (v), sizeof (arr))
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
//auto bet = [](const ll x, const ll y, const ll i) {
//    return x <= i && i <= y;
//};
//inline int h_bit(unsigned int x) {
//    return 31 - __builtin_clz(x);
//}
//inline int h_bitll(unsigned long long x) {
//    return 63 - __builtin_clzll(x);
//}
//
//struct frac{
//    using ll = long long;
//    ll fz, fm;
//    frac() = default;
//
//    frac(ll fz, ll fm) { // 构造函数变量名最好不要跟类成员名一样！
//        assert(fm != 0);
//        if (fm < 0) fm *= -1, fz *= -1;
//        ll g = __gcd(abs(fz), fm);
//        fz /= g, fm /= g;
//        this->fz = fz, this->fm = fm;
//    }
//
//    frac(ll x):fz(x),fm(1){} // implicit conversion
//
//    frac operator*(const frac &other)const{
//        return {fz * other.fz, fm * other.fm};
//    }
//
//    frac operator-()const{
//        return {-fz, fm};
//    }
//    frac operator-(const frac &other)const{
//        return *this + (-other);
//    }
//    frac operator+(const frac &other)const{
//        ll _fz = fz * other.fm + fm * other.fz;
//        ll _fm = fm * other.fm;
//        return {_fz, _fm};
//    }
//    bool operator==(const frac &other)const{
//        return other.fz == fz && other.fm == fm;
//    }
//    bool operator<(const frac &other)const{
//        return fz * other.fm < other.fz * fm;
//    }
//    bool operator>(const frac &other)const{
//        return fz * other.fm > other.fz * fm;
//    }
//    bool operator>=(const frac &other)const{
//        return !(*this < other);
//    }
//    bool operator<=(const frac &other)const{
//        return !(*this > other);
//    }
//    frac operator/(const int &x)const{
//        return {fz, fm * x};
//    }
//    double to_double() const {
//        return fz / (double)fm;
//    }
//
//};

template <typename T>
struct bit {
    vector<T> a;
    explicit bit(int n, int v = 0) {
        a.resize(n + 1);
        if(v != 0) {
            for (int i = 1; i <= n; ++i) a[i] = v;
        }
    }

    T sum(T x) {
        T res = 0;
        while (x) {
            res += a[x];
            x -= x & -x;
        }
        return res;
    }

    T sum(int l, int r) {
        if (l > r) return 0;
        return sum(r) - sum(l - 1);
    }

    void add(int x, T v) {
        while (x < a.size()) {
            a[x] += v;
            x += x & -x;
        }
    }
    void clear(){
        fill(a.begin(), a.end(), 0);
    }
};
vi get_prime(int n) {
    vi minp(n + 1), p;
    for (int i = 2; i <= n; i++) {
        if (!minp[i]) {
            minp[i] = i;
            p.pb(i);
        }
        FOR(x, p) {
            if (x <= minp[i] && x * i <= n)
                minp[x * i] = x;
            else break;
        }
    }
    return p;
}

const int mod = 1000000007;

inline void add_mod(ll &x, const ll &y) {
    x += y;
    if (x >= mod) x -= mod;
}
void sub_mod(ll &x, const ll &y) {
    x -= y;
    if (x < 0) x += mod;
}
// alias templates
template<typename T> using vv = vector<vector<T>>;
template <typename T1, typename T2 = T1> using vp = vector<pair<T1,T2>>;
template<typename T, int n> using va = vector<array<T,n>>;


using vec = vector<ll>;
using mat = vector<vec>;
mat get_I(int n) {
    mat res(n, vec(n));
    for (int i = 0; i < n; i++)
        res[i][i] = 1;
    return res;
}

mat operator*(const mat &a, const mat &b) {
    mat c(a.size(), vec(b[0].size()));
    for (size_t i = 0; i < a.size(); i++) {
        for (size_t j = 0; j < a[0].size(); j++) {
            if (a[i][j]) { // optimization for sparse matrix
                for (size_t k = 0; k < b[0].size(); k++) {
                    add_mod(c[i][k], a[i][j] * b[j][k] % mod);
                }
            }
        }
    }
    return c;
}

vec operator*(const mat &a, const vec &b) {
    vec c(a.size());
    for (size_t i = 0; i < a.size(); i++) {
        for (size_t j = 0; j < a[0].size(); j++) {
            add_mod(c[i], a[i][j] * b[j] % mod);
        }
    }
    return c;
}

mat pow(mat a, ll n) {
    mat res(a.size(), vec(a[0].size()));
    for (size_t i = 0; i < a.size(); i++) {
        res[i][i] = 1;
    }
    while (n) {
        if (n & 1) {
            res = res * a;
        }
        a = a * a;
        n >>= 1;
    }
    return res;
}
//union-find 并查集
struct UF{
    vi par;
    explicit UF(int n) {
        par.assign(n + 1, 0);
        rng (i, 1, n + 1) par[i] = i;
    }
    int find(int x) {
        return x == par[x] ? x : par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        par[find(x)] = find(y);
    }
};


vi get_popcnt(int n) {
    vi res(n + 1);
    rng (i, 0, n) {
        if (i * 2 <= n) res[i * 2] = res[i];
        if ((i & 1) == 0) res[i + 1] = res[i] + 1;
    }
    return res;
}

///////////////////////////////////////////////////////

struct node{
    int max;
    int lson, rson;
};
vector<node> tree;

inline void push_up(int i) {
    tree[i].max = max(tree[tree[i].lson].max, tree[tree[i].rson].max);
}

int insert(int x, int l, int r, int pos, int v) {
//    println("INSERT", x, l, r, pos, v);
    if (pos < l || pos > r) return x;
    if (l == r) {
        tree.push_back({min(v, tree[x].max), 0, 0});
//        println("sz", SZ(tree));
//        println(SZ(tree)-1, l, r, tree.back().max, 0, 0);
        return SZ(tree) - 1;
    }
    int mid = (l + r) / 2;
    tree.pb(node{}); // make a new node
    int i = SZ(tree) - 1;
    int ls = insert(tree[x].lson, l, mid, pos, v);
    int rs = insert(tree[x].rson, mid + 1, r, pos, v);
    tree[i].lson = ls;
    tree[i].rson = rs;
//    tree[i].lson = insert(tree[x].lson, l, mid, pos, v);
//    tree[i].rson = insert(tree[x].rson, mid + 1, r, pos, v);
    push_up(i);
//    println(i, l, r, tree[i].lson, tree[i].rson, tree[i].max);
    return i;
}

int query(int i, int l, int r, int ql, int qr) {
//    println(i, l, r, ql, qr);
    if (i == 0) {
//        println("i == 0");
        return INT_MAX;
    }
    if (ql <= l && r <= qr) {
//        assert(tree[i].max != INT_MAX);
        return tree[i].max;

    }
    int mid = (l + r) / 2;
    int res = 0;
    if (ql <= mid) res = max(res, query(tree[i].lson, l, mid, ql, qr));  // 在这个地方，我容易把ql写成l，需要注意！
    if (qr > mid) res = max(res, query(tree[i].rson, mid +1, r, ql, qr));
    return res;
}

struct X {
    int set_id, l, r;
    bool operator<(const X &other)const {
        return l < other.l;
    }
};

int main() {
    FAST_READ
#ifdef LOCAL
    ifstream in("main.in");
    cin.rdbuf(in.rdbuf());
#endif

    string s; cin >> s;
    ll ans = 0;
    int cb = 0;
    FOR(ch, s) {
        cb += ch == 'B';
        if (ch == 'W') {
            ans += cb;
        }
    }

    println(ans);

#ifdef LOCAL
    cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}



Measured memory_bytes: 720