S = eval(input())



S.lstrip("W")

def f(s):

    count = 1

    for i, si in enumerate(s):

        if si == 'W':

            yield (i+1) - count

            count += 1



print((sum(f(S))))

c = 0

s = 0

for i in eval(input()):

    if i == "W":

        s += c

    else:

        c += 1

print(s)
S = eval(input())
S.lstrip("W")


def f(s):
    count = 1
    for i, si in enumerate(s):
        if si == "W":
            yield (i + 1) - count
            count += 1


print((sum(f(S))))

c = 0
s = 0
for i in eval(input()):
    if i == "W":
        s += c
    else:
        c += 1
print(s)

-S = eval(input()) -S.lstrip("W") - - -def f(s): -    count = 1 -    for i, si in enumerate(s): -        if si == "W": -            yield (i + 1) - count -            count += 1 - - -print((sum(f(S)))) +c = 0 +s = 0 +for i in eval(input()): +    if i == "W": +        s += c +    else: +        c += 1 +print(s)