
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val s = cin.next()

    var ans: Long = 0
    var black_count = 0
    for (c in s) {
        if (c == 'W') {
            ans += black_count
        } else {
            black_count += 1
        }
    }
    println(ans)

}