import sys



s = [x for x in sys.stdin.readline().rstrip()]



black = float("inf")

ans = 0



for i in range(len(s)):

    if s[i] == "B" and black > i:

        black = i

    elif s[i] == "W" and black != float("inf"):

        ans += i - black

        black += 1



print(ans)
import sys





def main():

    s = sys.stdin.readline().rstrip()



    black = 0

    ans = 0



    for i in s:

        if i == "B":

            black = black + 1

        else:

            ans = ans + black



    print(ans)



    return





if __name__ == "__main__":

    main()
import sys

s = [x for x in sys.stdin.readline().rstrip()]
black = float("inf")
ans = 0
for i in range(len(s)):
    if s[i] == "B" and black > i:
        black = i
    elif s[i] == "W" and black != float("inf"):
        ans += i - black
        black += 1
print(ans)

import sys


def main():
    s = sys.stdin.readline().rstrip()
    black = 0
    ans = 0
    for i in s:
        if i == "B":
            black = black + 1
        else:
            ans = ans + black
    print(ans)
    return


if __name__ == "__main__":
    main()

-s = [x for x in sys.stdin.readline().rstrip()] -black = float("inf") -ans = 0 -for i in range(len(s)): -    if s[i] == "B" and black > i: -        black = i -    elif s[i] == "W" and black != float("inf"): -        ans += i - black -        black += 1 -print(ans) + +def main(): +    s = sys.stdin.readline().rstrip() +    black = 0 +    ans = 0 +    for i in s: +        if i == "B": +            black = black + 1 +        else: +            ans = ans + black +    print(ans) +    return + + +if __name__ == "__main__": +    main()