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:
    record = input()
    
    if record=='0' :
        break
    
    rlist = list(record)
    
    rlen = len(rlist)
    
    A = 0
    B = 0
    
    for i in range(1,rlen,1):
        
        if rlist[i]=='A' :
            A += 1
        if rlist[i]=='B' :
            B += 1
        
        if i==rlen-1 :
            if A>B:
                A += 1
            if B>A:
                B += 1
    
    print(A,B)
    continue

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:
    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:
    l=str(input())
    if l=="0": break
    A,B = 0,0
    for i in range(1,len(l)):
        if l[i]=="A":
            A+=1
        else:
            B+=1
    if A>B:
        A+=1
    else:
        B+=1
    print(A,B)

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

Python: while True:
    g1=input()
    if g1=="0":
        break
    g2=input()
    g3=input()
    r1a=g1[1:].count("A")
    r1b=g1[1:].count("B")
    if g2[0]=="A":
        r1a+=1
    if g2[0]=="B":
        r1b+=1
    print(r1a,r1b)
    r2a=g2[1:].count("A")
    r2b=g2[1:].count("B")
    if g3[0]=="A":
        r2a+=1
    if g3[0]=="B":
        r2b+=1
    print(r2a,r2b)
    r3a=g3[1:].count("A")
    r3b=g3[1:].count("B")
    if r3a>r3b:
        r3a+=1
    if r3a<r3b:
        r3b+=1
    print(r3a,r3b)

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: while True:
    n=input()
    if n=="0":
        break
    s,t=n[1:].count('A'),n[1:].count('B')
    if s<t:
        print(s+0,t+1)
    else:
        print(s+1,t+0)

Python: while True:
    d = input()
    if d == '0':
        break
    D = list(d)
    A_t = 0
    B_t = 0
    for i in range(1,len(D)):
        if D[i] == "A":
            A_t += 1
        elif D[i] == "B":
            B_t += 1
    if A_t > B_t:
        A_t += 1
    elif A_t < B_t:
        B_t += 1
    print(A_t, B_t)

Python: def calc(S):
    p = q = 0
    for c in S[1:]:
        if c == 'A':
            p += 1
        else:
            q += 1
    return p, q
def check(p, q):
    if q < 10:
        return p == 11
    return p - q == 2

while 1:
    S1 = input()
    if S1 == "0":
        break
    S2 = input()
    S3 = input()

    p1, q1 = calc(S1)
    if S2[0] == 'A':
        p1 += 1
    else:
        q1 += 1
    print(p1, q1)

    p2, q2 = calc(S2)
    if S3[0] == 'A':
        p2 += 1
    else:
        q2 += 1
    print(p2, q2)

    p3, q3 = calc(S3)
    if check(p3+1, q3):
        print(p3+1, q3)
    else:
        print(p3, q3+1)

Python: # Your code here!
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:
    n=input()
    if n=='0':
        break
    a=list(n)
    A=0
    B=0
    for i in range(1,len(a)):
        if a[i]=='A':
            A+=1
        else:
            B+=1
    if A<=10 and B<=10:
        if A==10:
            A+=1
        if B==10:
            B+=1
    else:
        if A<B:
            B+=1
        else:
            A+=1
    print(A,B)

Python: while True:
    x = str(input())
    if x == '0':
        break
    x = str(x)
    a = x[1:].count('A')
    b = x[1:].count('B')
    if a < 10:
        b = b + 1
    elif b < 10:
        a = a + 1
    elif a >= 10 and b >= 10 and a > b:
        a = a + 1
    elif a >= 10 and b>= 10 and b > a:
        b = b + 1
    print(a, b)

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

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

Python: while True:
   d = input()
   if d == '0':
      break
   D = list(d)
   A_t = 0
   B_t = 0
   for i in range(1,len(D)):
      if D[i] == "A":
         A_t += 1
      elif D[i] == "B":
         B_t += 1
   if A_t > B_t:
      A_t += 1
   elif A_t < B_t:
      B_t += 1
   print(A_t, B_t)

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:
    po=input()
    if po=="0":
        break
    A,B=0,0
    for i in range(1,len(po)):
        if po[i]=="A":
            A+=1
        else :
            B+=1
    if A>B:
        A+=1
    else :
        B+=1
    print(A,B)

Python: # Aizu Problem 00174: Badminton
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def badminton(game):
    a, b = 0, 0
    for x in game[1:]:
        if x == 'A':
            a += 1
        else:
            b += 1
    if a > b:
        a += 1
    else:
        b += 1
    return a, b


while True:
    game = input().strip()
    if game[0] == '0':
        break
    a, b = badminton(game)
    print(a, b)

Python: def calc(S):
    p = q = 0
    for c in S[1:]:
        if c == 'A':
            p += 1
        else:
            q += 1
    return p, q
def check(p, q):
    if q < 10:
        return p == 11
    return p - q == 2

while 1:
    S1 = input()
    if S1 == "0":
        break
    S2 = input()
    S3 = input()

    p1, q1 = calc(S1)
    if S2[0] == 'A':
        p1 += 1
    else:
        q1 += 1
    print(p1, q1)

    p2, q2 = calc(S2)
    if S3[0] == 'A':
        p2 += 1
    else:
        q2 += 1
    print(p2, q2)

    p3, q3 = calc(S3)
    if check(p3+1, q3):
        print(p3+1, q3)
    else:
        print(p3, q3+1)

Python: for i in range(20) :
    n=input()
    if n=='0':
        break
    a=n[1:].count('A')
    b=n[1:].count('B')
    if a>b :
        a=a+1
    else :
        b=b+1
   
    print(a,b)

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

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