
import scala.annotation.tailrec
import scala.collection.mutable

object Main extends App {

  import scala.io.StdIn._

  solve
  @tailrec
  def solve: Unit = {
    val record = readLine.trim
    if (record == "0") return
    val (a, b) = calScore(record.tail.toList)
    println(s"$a $b")
    solve
  }
  @tailrec
  def calScore(serves: List[Char], pointA: Int = 0, pointB: Int = 0): (Int, Int) = {
    serves match {
      case Nil if pointA > pointB ⇒ (pointA + 1, pointB)
      case Nil ⇒ (pointA, pointB + 1)
      case 'A'::t ⇒ calScore(t, pointA + 1, pointB)
      case 'B'::t ⇒ calScore(t, pointA, pointB + 1)
    }
  }
  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}
