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