object Main extends App{
    val s = scala.io.StdIn.readLine
    
    val w_counts = s.count(_ == 'W')
    
    val w_list = (1 to s.length).map(e => (e, s(e-1))).filter(e => e._2 == 'W').map(_._1)
    val output = (1 to w_counts).map(e => w_list(e-1) - e).sum
    
    
    println(output)
}
