fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()
    var answer = 0L
    var count = 0
    s.forEachIndexed { index, c ->
        if (c == 'W') {
            answer += index - count
            count++
        }
    }
    print(answer)
}