fun main(args: Array<String>) {
    val s = readLine()!!
    var cnt = 0.0
    var wcnt = 0.0
    s.forEachIndexed { index, c ->
        if (c == 'W') {
            cnt += index - wcnt
            wcnt++
        }
    }
    println(String.format("%.0f", cnt))
}