Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	flag := true
	for {
		for i := 0; i < 3; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), "")
			if buf[0] == "0" {
				flag = false
				break
			}
			a, b := 0, 0
			buf = buf[1:]
			for _, v := range buf {
				if string(v) == "A" {
					a++
				} else {
					b++
				}
			}
			if a > b {
				a++
			} else {
				b++
			}
			fmt.Println(a, b)
		}
		if !flag {
			break
		}
	}
}

Python: while True:
    n1=input()
    if n1=="0":
        break
    n2=input()
    n3=input()
    l1=len(n1)
    l2=len(n2)
    l3=len(n3)

    if n1=="0":
        break
    else:
        a1=n1.count("A",1)
        b1=n1.count("B",1)
        if n2[:1]=="A":
            a1+=1
        if n2[:1]=="B":
            b1+=1
        print(a1,b1)
        
        a2=n2.count("A",1)
        b2=n2.count("B",1)
        if n3[:1]=="A":
            a2+=1
        if n3[:1]=="B":
            b2+=1
        print(a2,b2)
        
        a3=n3.count("A",1)
        b3=n3.count("B",1)
        if a3>b3:
            a3+=1
        if a3<b3:
            b3+=1
        print(a3,b3)

Python: while True:
    rec = str(input())
    if rec == "0":
        break
    A = 0
    B = 0
    for i in range(1, len(rec)):
        if rec[i] == "A":
            A += 1
        else:
            B += 1
    if A > B:
        A += 1
    else:
        B += 1
    print(A,B)

Python: while True:
    a=input()
    if a=='0':break
    d,e=a[1:].count('A'),a[1:].count('B')
    (b,c)=(0,1) if d<e else (1,0)
    print(d+b,e+c)

Python: # coding: utf-8
# Your code here!

while 1:
  x = input()
  if x == "0":
    break
  a = 0
  b = 0
  for i in range(1,len(x)):
    if x[i] == "A":
      a += 1
    else:
      b += 1
  if a > b:
    a += 1
  else:
    b += 1
  print(a,b)

Python: while True:
    n = input()
    if n == '0': break
    a = n[1:].count('A')
    b = n[1:].count('B')
    if a < b:
        print(a+0, b+1)
    else:
        print(a+1, b+0)

Python: while True:
    record = input()
    if record == "0":
        break
    
    scoreA = record[1:].count("A")
    scoreB = record[1:].count("B")

    if scoreA > scoreB:
        scoreA += 1
    else:
        scoreB += 1
    print(scoreA, scoreB)

Python: while True:
    re=input()
    if re=="0":
        break
    Are,Bre=0,0
    for i in range(1,len(re)):
        if re[i]=="A":
            Are+=1
        else :
            Bre+=1
    if Are>Bre:
        Are+=1
    else :
        Bre+=1
    print(Are,Bre)

Python: #62 バドミントン

f = True
while True:
    for k in range(3):
        p = list(input())
        if p[0] == '0':
            f = False
            break
        
        a, b = 0, 0
        del p[0]
        for x in p:
            if x == 'A': a += 1
            else: b += 1
        if a > b: a += 1
        else: b += 1
        print(a, b)
    if not f: break

Python: # AOJ 0174 Badminton
# Python3 2018.6.19 bal4u

f = True
while True:
	for k in range(3):
		p = list(input())
		if p[0] == '0':
			f = False
			break
		a, b = 0, 0
		del p[0]
		for x in p:
			if x == 'A': a += 1
			else: b += 1
		if a > b: a += 1
		else: b += 1
		print(a, b)
	if not f: break

Python: while True:
    record = str(input())
    if record == "0":
        break
    A = 0
    B = 0
    for i in range(1, len(record)):
        if record[i] == "A":
            A += 1
        else:
            B += 1
    if A > B:
        A += 1
    else:
        B += 1
    print(A,B)

Python: #0174
while True:
    A = 0
    B = 0
    r = input()
    if r == '0':
        break
    for i in range(1,len(r)):
        if r[i] == 'A':
            A += 1
        else:
            B += 1
    if A > B:
        A += 1
    elif B > A:
        B += 1

    print(A,B)

Python: f = True
while True:
	for k in range(3):
		p = list(input())
		if p[0] == '0':
			f = False
			break
		a, b = 0, 0
		del p[0]
		for x in p:
			if x == 'A': a += 1
			else: b += 1
		if a > b: a += 1
		else: b += 1
		print(a, b)
	if not f: break

Python: while 1:
    rec = str(input())
    if rec == '0':
        break
    #Rec = list(rec.split())
    
    Acount = rec[1:].count('A')
    Bcount = rec[1:].count('B')
    #print('*', Acount, Bcount)
    
    if Acount < Bcount:
        print(Acount, Bcount+1)
    else:
        print(Acount+1, Bcount)

Python:   
while True:
	str = input();
	if (str == '0'):
		break;
	
	scorea = 0;
	scoreb = 0;
	for i in range(1, len(str)):
		if (str[i] == 'A'):
			scorea += 1;
		else:
			scoreb += 1;
	
	if (scorea > scoreb):
		scorea += 1;
	else:
		scoreb += 1;
	
	print(scorea, scoreb);

Python: while 1:
    a=input()
    if a=='0':break
    d,e=a[1:].count('A'),a[1:].count('B')
    (b,c)=(0,1) if d<e else (1,0)
    print(d+b,e+c)

Python: while True:
   record=input()
   if record=='0':
       break
   R = record[1:]
   if R.count('A')>R.count('B'):
       print(R.count('A')+1,R.count('B'))
   else:
       print(R.count('A'),R.count('B')+1)

Python: from collections import Counter

while True:
    input_item = input()

    if input_item == "0":
        break

    input_list = []
    input_list.append(input_item)
    input_list.append(input())
    input_list.append(input())

    for item in input_list:
        count = Counter(item)
        count[item[0]] -= 1

        if count["A"] > count["B"]:
            count["A"] += 1
        else:
            count["B"] += 1

        print(count["A"], count["B"])

Python: while 1:
	x=input()
	if x=="0":
		break
	a=0
	b=0
	for i in range(1,len(x)):
		if x[i]=="A":
			a+=1
		else:
			b+=1
	if a>b:
		a+=1
	else:
		b+=1
	print(a,b)

Python: while True:
    s=input()
    if s=="0":
        break
    
    a,b=s[1::].count("A"),s[1::].count("B") #最後の一回以外
    if a<b:  #最後
        x,y=0,1
    else:
        x,y=1,0
    print(a+x,b+y)

Python: while True:
    r = input()
    if r == "0":
        break
    m = r.count("A")
    n = r.count("B")
    if r[0] == "A":
        m -= 1
    else:
        n -= 1
    if m > n:
        m += 1
    else:
        n += 1
    print(m,n)

Python: # coding: utf-8
# Your code here!

while True:
   r1 = input()
   if r1 == "0": break
   r2 = input()
   r3 = input()
   
   s1A = r1[1 : len(r1)].count("A")
   s1B = len(r1) - 1 - s1A
   s2A = r2[1 : len(r2)].count("A")
   s2B = len(r2) - 1 - s2A
   s3A = r3[1 : len(r3)].count("A")
   s3B = len(r3) - 1 - s3A
   
   if r2[0] == "A":
      s1A += 1
   else:
      s1B += 1
   
   if r3[0] == "A":
      s2A += 1
   else:
      s2B += 1

   if s3A > s3B:
      s3A += 1
   else:
      s3B += 1
      
   print(s1A, s1B)
   print(s2A, s2B)
   print(s3A, s3B)

Python: while True:
    r=input()
    if r == '0':
        break
    a=r[1:].count('A')
    b=r[1:].count('B')
    if a<b:
        print(a,b+1)
    else:
        print(a+1,b)

Python: while 1:
  x = input()
  if x == "0":
    break
  a = 0
  b = 0
  for i in range(1,len(x)):
    if x[i] == "A":
      a += 1
    else:
      b += 1
  if a > b:
    a += 1
  else:
    b += 1
  print(a,b)

Python: while True:
    record = input()
    if record == "0":
        break
    
    scoreA = record[1:].count("A")
    scoreB = record[1:].count("B")
    
    if scoreA > scoreB:
        scoreA += 1
    else:
        scoreB += 1
    print(scoreA,scoreB)

Python: while True:
    r = input()
    if r == "0":
        break

    A,B = 0,0
    for i in range(1, len(r)):
        if r[i] == "A":
            A += 1
        else:
            B += 1

    if A == 10 and B < 10:
        A += 1
    elif B == 10 and A < 10:
        B += 1
    elif A > B:
        A += 1
    else:
        B += 1

    print(A, B)

Python: # coding: utf-8
# Your code here!
while True:
    r=str(input())
    
    if r=='0':
        break
    A,B=0,0
    for i in range(1,len(r)):
        if r[i]=='A':
            A+=1
        else:
            B+=1
    if A>B:
        A+=1
    else:
        B+=1
    
    print(A,B)