s=  eval(input())

W = 'W'

B = 'B'

Bi = []

Wi = []



BC = s.count(B)

WC = len(s) - BC



for i in range(len(s)):

  if s[i] == B:

    Bi.append(i)

  else:

    Wi.append(i)

    

W_dist = sum(Wi) - int((0 + WC-1)* (WC)/2)

#print('W',str(W_dist))



B_dist = int((len(s)-1 + WC) * BC /2) - sum(Bi)

#print('B',str(B_dist))



print((int((W_dist + B_dist)/2)))
S = eval(input())

BC = S.count('B')

WC = len(S) - BC



ans = 0

for i in range(len(S)):

  if S[i] == 'B':

    ans += WC

  else:

    WC -= 1

print(ans)
s = eval(input())
W = "W"
B = "B"
Bi = []
Wi = []
BC = s.count(B)
WC = len(s) - BC
for i in range(len(s)):
    if s[i] == B:
        Bi.append(i)
    else:
        Wi.append(i)
W_dist = sum(Wi) - int((0 + WC - 1) * (WC) / 2)
# print('W',str(W_dist))
B_dist = int((len(s) - 1 + WC) * BC / 2) - sum(Bi)
# print('B',str(B_dist))
print((int((W_dist + B_dist) / 2)))

S = eval(input())
BC = S.count("B")
WC = len(S) - BC
ans = 0
for i in range(len(S)):
    if S[i] == "B":
        ans += WC
    else:
        WC -= 1
print(ans)

-s = eval(input()) -W = "W" -B = "B" -Bi = [] -Wi = [] -BC = s.count(B) -WC = len(s) - BC -for i in range(len(s)): -    if s[i] == B: -        Bi.append(i) +S = eval(input()) +BC = S.count("B") +WC = len(S) - BC +ans = 0 +for i in range(len(S)): +    if S[i] == "B": +        ans += WC -        Wi.append(i) -W_dist = sum(Wi) - int((0 + WC - 1) * (WC) / 2) -# print('W',str(W_dist)) -B_dist = int((len(s) - 1 + WC) * BC / 2) - sum(Bi) -# print('B',str(B_dist)) -print((int((W_dist + B_dist) / 2))) +        WC -= 1 +print(ans)