fun main(args: Array<String>) {
    agc029a()
}

fun agc029a() {
    val s = readLine()!!.map { it == 'W' }.toBooleanArray()

    val wPos = mutableListOf<Long>()
    for (i in s.indices) if (s[i]) wPos.add(i.toLong())

    if (wPos.size == 0 || wPos.size == s.size) return println(0)

    val answer = wPos.sum() - (wPos.size - 1).toLong() * wPos.size / 2

    println(answer)
}
