fun main(args:Array<String>) {
    val s = readLine()!!
    var firstBlack = s.indexOf('B')
    if(firstBlack < 0) {
        println(0)
        return
    }
    var ans = 0L
    for(i in (0 until s.length)) {
        if(i < firstBlack) {
            continue
        }
        if(s[i] == 'W') {
            ans += (i-firstBlack)
            firstBlack++
        }
    }
    println(ans)
}
