fun main(args: Array<String>) {
    val s = readLine() ?: return
    var c = 0L
    var w = 0
    s.forEachIndexed { i, ss ->
        if (ss == 'W') {
            c += i - w
            w++
        }
    }
    println(c.toString())
}
