S = eval(input())

sumW = 0

total = 0

for i in reversed(list(range(len(S)))):

    if S[i] == "W":

        sumW += 1

    elif S[i] == "B":

        total += sumW

print(total)

import sys



def solve():

    S = eval(input())

    count = 0

    leftMostW = 0

    for i in range(len(S)):

        if S[i] == "W":

            count += i - leftMostW

            leftMostW += 1

    print(count)



    return 0



if __name__ == "__main__":

    solve()
S = eval(input())
sumW = 0
total = 0
for i in reversed(list(range(len(S)))):
    if S[i] == "W":
        sumW += 1
    elif S[i] == "B":
        total += sumW
print(total)

import sys


def solve():
    S = eval(input())
    count = 0
    leftMostW = 0
    for i in range(len(S)):
        if S[i] == "W":
            count += i - leftMostW
            leftMostW += 1
    print(count)
    return 0


if __name__ == "__main__":
    solve()

-S = eval(input()) -sumW = 0 -total = 0 -for i in reversed(list(range(len(S)))): -    if S[i] == "W": -        sumW += 1 -    elif S[i] == "B": -        total += sumW -print(total) +import sys + + +def solve(): +    S = eval(input()) +    count = 0 +    leftMostW = 0 +    for i in range(len(S)): +        if S[i] == "W": +            count += i - leftMostW +            leftMostW += 1 +    print(count) +    return 0 + + +if __name__ == "__main__": +    solve()