S = list(eval(input()))

c = 0

for i in range(len(S)):

    if S[i] == 'W':

        c += i

sc = S.count('W')

print((int(c - sc*(sc-1)//2)))
S = eval(input())

wc = 0

w = S.count('W')

for i in range(len(S)):

    if S[i] == 'W':

        wc += i

print((wc - w*(w-1)//2))
S = list(eval(input()))
c = 0
for i in range(len(S)):
    if S[i] == "W":
        c += i
sc = S.count("W")
print((int(c - sc * (sc - 1) // 2)))

S = eval(input())
wc = 0
w = S.count("W")
for i in range(len(S)):
    if S[i] == "W":
        wc += i
print((wc - w * (w - 1) // 2))

-S = list(eval(input())) -c = 0 +S = eval(input()) +wc = 0 +w = S.count("W") -        c += i -sc = S.count("W") -print((int(c - sc * (sc - 1) // 2))) +        wc += i +print((wc - w * (w - 1) // 2))