if __name__ == "__main__":

    S = eval(input())

    ans = 0

    bcount = 0

    for i in range(len(S)):

        if S[i] == 'B':

            bcount += 1

        else:

            ans += bcount



    print(ans)

if __name__ == "__main__":

    s = eval(input())



    bcount = 0

    ans = 0



    for ss in s:

        if ss == 'B':

            bcount += 1

        else:

            ans += bcount



    print(ans)

if __name__ == "__main__":
    S = eval(input())
    ans = 0
    bcount = 0
    for i in range(len(S)):
        if S[i] == "B":
            bcount += 1
        else:
            ans += bcount
    print(ans)

if __name__ == "__main__":
    s = eval(input())
    bcount = 0
    ans = 0
    for ss in s:
        if ss == "B":
            bcount += 1
        else:
            ans += bcount
    print(ans)

-    S = eval(input()) +    s = eval(input()) +    bcount = 0 -    bcount = 0 -    for i in range(len(S)): -        if S[i] == "B": +    for ss in s: +        if ss == "B":