a,s,b=0,eval(input()),0

for i in range(len(s)):a+=i*(s[i]=="W");b+=(s[i]=="W")

print((a-((b*(b-1))//2)))
a,s,b=0,eval(input()),0

for i in range(len(s)):

  if s[i]=="W":a+=i;b+=1

print((a-((b*(b-1))//2)))
a, s, b = 0, eval(input()), 0
for i in range(len(s)):
    a += i * (s[i] == "W")
    b += s[i] == "W"
print((a - ((b * (b - 1)) // 2)))

a, s, b = 0, eval(input()), 0
for i in range(len(s)):
    if s[i] == "W":
        a += i
        b += 1
print((a - ((b * (b - 1)) // 2)))

-    a += i * (s[i] == "W") -    b += s[i] == "W" +    if s[i] == "W": +        a += i +        b += 1