import java.io.BufferedReader
import java.io.InputStreamReader

class A

fun main( args: Array<String> ) {
    val br = BufferedReader( InputStreamReader( System.`in` ) )
    val s = br.readLine()
    var w = 0L
    var r = 0L
    for ( i in s.lastIndex downTo 0 ) {
        if ( s[i] == 'W' ) {
            w ++
        } else {
            r += w
        }
    }
    println( r )
}