fun main(args: Array<String>) {
    val s = readString()

    var cnt = 0L
    var ans = 0L
    for (i in s.indices) {
        if (s[i] == 'W') {
            ans += cnt
        } else {
            cnt++
        }
    }
    println(ans)
}

// Tools
fun readString() = readLine()!!