S = input()
c = 0
ans = 0
for s in S :
    if s == 'B' :
        c += 1
    else :
        ans += c
print(ans)