require 'enumerator'

loop do
  line1 = gets.chomp
  break if line1 =="0"
  a=0
  b=0
  line1.split("").each_cons(2) do |arr|
    if arr[1]=="A"
      a+=1
    else
      b+=1
    end
  end
  line2 = gets.chomp
  if(line2.split("")[0]=="A")
    a+=1
  else
    b+=1
  end
  puts a.to_s+" "+b.to_s
  a=0
  b=0
  line2.split("").each_cons(2) do |arr|
    if arr[1]=="A"
      a+=1
    else
      b+=1
    end
  end
  line3 = gets.chomp
  if(line3.split("")[0]=="A")
    a+=1
  else
    b+=1
  end
  puts a.to_s+" "+b.to_s
  a=0
  b=0
  line3.split("").each_cons(2) do |arr|
    if arr[1]=="A"
      a+=1
    else
      b+=1
    end
  end
  if a>b
    a+=1
  elsif b>a
    b+=1
  end
  puts a.to_s+" "+b.to_s
end