import scala.io.{StdIn => in}

object Main extends App {
  val s = in.readLine

  val ans = (0 until s.size)./:((0L, 0)) { case ((acc,cnt),i) =>
    if(s(i) == 'W') (acc+(i-cnt), cnt+1)
    else (acc, cnt)
  }._1

  println(ans)
}