loop do
  ss = [gets.chomp]
  break if ss[0] == ?0
  ss += 2.times.map { gets.chomp }
  ss.each_with_index do |s|
    a, b = 0, 0
    s.each_char.drop(1).each do |c|
      if c == ?A
        a += 1
      else
        b += 1
      end
    end
    if a > b
      a += 1
    else
      b += 1
    end
    puts "#{a} #{b}"
  end
end