fun main(array: Array<String>) {
    val s = readLine()!!
    val arr = s.map { it == 'W' }.toBooleanArray()
    val list = mutableListOf<Long>()

    for(i in arr.indices) {
        if(arr[i]) {
            list.add(i.toLong())
        }
    }
    if(list.size == 0 || list.size == s.length) {
        return print(0)
    }
    print(list.sum().toLong() - (list.size.toLong() - 1) * list.size.toLong() / 2)
}
