S = list(eval(input()))



#print(S)



n = 1 if S[0] == "W" else 0# number of white string

count = 0

for i in range(1, len(S)):

    if S[i] == "W":

        count += i - n

        n += 1

        #print("n is", n)

        #print("count is ", count)

print(count)





S = eval(input())

bcount = 0

ans = 0

for i in range(len(S)):

    if S[i] == "B":# countup B(= empty space)

        bcount += 1

    else:          # countup W shift value

        ans += bcount

print(ans)

S = list(eval(input()))
# print(S)
n = 1 if S[0] == "W" else 0  # number of white string
count = 0
for i in range(1, len(S)):
    if S[i] == "W":
        count += i - n
        n += 1
        # print("n is", n)
        # print("count is ", count)
print(count)

S = eval(input())
bcount = 0
ans = 0
for i in range(len(S)):
    if S[i] == "B":  # countup B(= empty space)
        bcount += 1
    else:  # countup W shift value
        ans += bcount
print(ans)

-S = list(eval(input())) -# print(S) -n = 1 if S[0] == "W" else 0  # number of white string -count = 0 -for i in range(1, len(S)): -    if S[i] == "W": -        count += i - n -        n += 1 -        # print("n is", n) -        # print("count is ", count) -print(count) +S = eval(input()) +bcount = 0 +ans = 0 +for i in range(len(S)): +    if S[i] == "B":  # countup B(= empty space) +        bcount += 1 +    else:  # countup W shift value +        ans += bcount +print(ans)