s = input() t = 0 ans = 0 for i in range(len(s)): if s[i] == 'B': t += 1 else: ans += t print(ans)