fun main(args: Array<String>){
    
    while (true) {

        val line = readLine() ?: ""
        var a = 0
        var b = 0

        if (line == "0" || line == "") {
            break
        }
        for (i in 1..line.length -1 ) {
            when (line.get(i)) {
                'A' -> a++
                'B' -> b++
                else -> {}
            }
        }

        if (a > b) a++
        else b++

        println("${a} ${b}")
    }
}
