object Main extends App {
  @scala.annotation.tailrec
  def loop(chars: Seq[Char], step: Long, acc: Long): Long = chars match {
    case Seq() => acc
    case 'W' :: xs =>
      loop(xs, step, acc + step)
    case _ =>
      val (bs, xs) = chars.span(_ != 'W')
      loop(xs, bs.length + step, acc)
  }

  val sc = new java.util.Scanner(System.in)
  println(loop(sc.next().toCharArray.toList, 0, 0))
}
