import sys

# input = sys.stdin.readline



def main():

    s = eval(input())

    total = 0



    for i in range(len(s)-1):

        if s[i] == "B":

            total += 1

            if s[i] == "B" and s[i+1] == "W":

                yield total

        else:

            if s[i] == "W" and s[i+1] == "W":

                yield total



print((sum(main())))
import sys

# input = sys.stdin.readline



def main():

    s = eval(input())



    b = 0

    for c in s:

        if c == "B":

            b += 1

        else:

            yield b



print((sum(main())))
import sys

# input = sys.stdin.readline
def main():
    s = eval(input())
    total = 0
    for i in range(len(s) - 1):
        if s[i] == "B":
            total += 1
            if s[i] == "B" and s[i + 1] == "W":
                yield total
        else:
            if s[i] == "W" and s[i + 1] == "W":
                yield total


print((sum(main())))

import sys

# input = sys.stdin.readline
def main():
    s = eval(input())
    b = 0
    for c in s:
        if c == "B":
            b += 1
        else:
            yield b


print((sum(main())))

-    total = 0 -    for i in range(len(s) - 1): -        if s[i] == "B": -            total += 1 -            if s[i] == "B" and s[i + 1] == "W": -                yield total +    b = 0 +    for c in s: +        if c == "B": +            b += 1 -            if s[i] == "W" and s[i + 1] == "W": -                yield total +            yield b