while input = gets.chomp
  break if input == "0"
  a = 0
  b = 0
  input[1..-1].chars do |serve|
    case serve
    when "A"
      a += 1
    when "B"
      b += 1
    end
  end
  a < b ? b += 1 : a += 1
  puts "#{a} #{b}"
end