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