object Main extends App {
  private def func(s:Array[Char]):Int = {
    var count = 0
    var last = 0
    //do{
      var i=0
      while(i < s.size){
        if(s(i)=='W'){
          last += 1
          count += (i - last + 1)
        }
        i+=1
        //println(count, i, find, s.toSeq)
      } 
    //} while(false/*find*/)
    count
  }
  println(func(io.Source.stdin.getLines.toIndexedSeq.head.toCharArray))
}
