import sys

import numpy as np



stdin = sys.stdin

 

ri = lambda: int(rs())

rl = lambda: list(map(int, stdin.readline().split()))

rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces



S = list(rs())

W = [0] * len(S)

for i in range(len(S)):

    if S[i] == 'W':

        W[i] = 1

W = np.array(W[::-1])

W_cum = W.cumsum()[::-1]

W_cum = W_cum.tolist()

answer = 0

for i in range(len(S)):

    if S[i] == 'B':

        answer += W_cum[i]



print(answer)
import sys

import numpy as np



stdin = sys.stdin

 

ri = lambda: int(rs())

rl = lambda: list(map(int, stdin.readline().split()))

rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces



S = list(rs())

cnt_B = 0

answer = 0

for s in S:

    if s == 'B':

        cnt_B += 1

    else:

        answer += cnt_B

print(answer)

import sys
import numpy as np

stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces
S = list(rs())
W = [0] * len(S)
for i in range(len(S)):
    if S[i] == "W":
        W[i] = 1
W = np.array(W[::-1])
W_cum = W.cumsum()[::-1]
W_cum = W_cum.tolist()
answer = 0
for i in range(len(S)):
    if S[i] == "B":
        answer += W_cum[i]
print(answer)

import sys
import numpy as np

stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces
S = list(rs())
cnt_B = 0
answer = 0
for s in S:
    if s == "B":
        cnt_B += 1
    else:
        answer += cnt_B
print(answer)

-W = [0] * len(S) -for i in range(len(S)): -    if S[i] == "W": -        W[i] = 1 -W = np.array(W[::-1]) -W_cum = W.cumsum()[::-1] -W_cum = W_cum.tolist() +cnt_B = 0 -for i in range(len(S)): -    if S[i] == "B": -        answer += W_cum[i] +for s in S: +    if s == "B": +        cnt_B += 1 +    else: +        answer += cnt_B