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:
    ten=input()
    if ten=='0':
        break
    a=ten.count('A')
    b=ten.count('B')
    if ten[0]=='A':
        a-=1
    elif ten[0]=='B':
        b-=1
    if a>b:
        a+=1
    else:
        b+=1
    print(a,b)

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 1:
    x = list(input())
    if x[0] == "0":
        break
    x.pop(0)
    a = x.count("A")
    b = x.count("B")
    if  a > b:
        x.append("A")
    else:
        x.append("B")
    print(x.count("A"),x.count("B"))

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

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

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

Python: while True:
    record=input()
    if record=='0':
        break
    else:
        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:
    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: 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:
    s = input()
    if s == "0":
        break
    L = list(s)
    P = [0]*2
    for i in range(len(L)-1):
        if L[i+1] == "A":
            P[0] += 1
        else:
            P[1] += 1

    if P[0] > P[1]:
        P[0] += 1
    else:
        P[1] += 1
    
    print(*P)

Python: L=[]
A=0
B=0

try:
    while True:
        M=str(input())
        L.append(M)
        
except EOFError:
    pass

N=len(L)
L.remove(L[N-1])
N=len(L)

for i in range(N):
    P=list(L[i])

    P.remove(P[0])
    if i==N-1 or i//3==0:
        A=P.count('A')
        B=P.count('B')
        if A>B:
            A+=1
        else:
            B+=1
        print(A,B)
    
    else:
        A=P.count('A')
        B=P.count('B')
        Q=list(L[i+1])
        if Q[0]=='A':
            A+=1
        else:
            B+=1
        print(A,B)
    
    i+=1

Python: def solve(record):
    point_a = 0
    point_b = 0
    while record != []:
        if record.pop(0) == "A":
            point_a += 1
        else:
            point_b += 1
    if point_a > point_b:
        point_a += 1
    else:
        point_b += 1
    print(point_a, point_b)


while 1:
    record1 = list(input())
    if record1[0] == "0":
        break

    record1.pop(0)
    solve(record1)

    record2 = list(input())
    record2.pop(0)
    solve(record2)

    record3 = list(input())
    record3.pop(0)
    solve(record3)

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

Python: def judge(r):
  pa = pb = 0
  for c in r[1:]:
    if c == "A":
      pa += 1
    else:
      pb += 1
  if pa < pb:
    print(pa, pb + 1)
  else:
    print(pa + 1, pb)
while True:
  r1 = input()
  if r1 == "0":
    break
  judge(r1)
  judge(input())
  judge(input())

Python: while True:
    n=str(input())
    if n=='0':
        break
    B=len(n)
    N=list(n)
    a=0
    b=0
    for i in range(B-1):
        C=N[i+1]
        if C=='A':
            a=a+1
        else:
            b=b+1
    if a>b:
        a=a+1
    else:
        b=b+1
    print(a,b)

Python: x = 0
y = 0

while True:
    R1 = input()
    if R1 == '0':
        break
    R2 = input()
    R3 = input()
    
    R1A = R1[1:].count('A')
    R1B = len(R1)-R1A-1
    if R2[0]=='A':
        R1A += 1
    else:
        R1B += 1
        
    R2A = R2[1:].count('A')
    R2B = len(R2)-R2A-1
    if R3[0] == 'A':
        R2A += 1
    else:
        R2B += 1
        
    R3A = R3[1:].count('A')
    R3B = len(R3)-R3A-1
    if R3A > R3B:
        R3A += 1
    else:
        R3B += 1
        
    print(R1A, R1B)
    print(R2A, R2B)
    print(R3A, R3B)

Python: import sys
while True:
    a=[]
    for i in range(3):
        z=str(input())
        if z=="0":
            sys.exit()
        a.append(z)
    A,B,C=a[0],a[1],a[2]
    A=A[1:]+B[0]
    B=B[1:]+C[0]
    C=C[1:]
    print(A.count("A"), A.count("B"))
    print(B.count("A"), B.count("B"))
    d,e=C.count("A"),C.count("B")
    if d>e:
        d+=1
    else:
        e+=1
    print(d,e)

Python: # coding: utf-8
# 62

while True:
    KA = int(0)
    KB = int(0)
    r = input()
    if r=='0':
        break

    for i in range(1,len(r)):
        if r[i]=='A':
            KA += 1
        else:
            KB += 1
    if KA>KB:
        KA += 1
    elif KB>KA:
        KB += 1
    
    print(KA,KB)

Python: while True:
    R=str(input())
    if R=='0':
        break
    r=list(R)
    a=0
    b=0
    for i in range(len(r)-1):
        if r[i+1]=='A':
            a+=1
        else:
            b+=1
    if a>b:
        print(a+1,b)
    else:
        print(a,b+1)

Python: try:
    while True:
        x = input()
        if x=='0':
            break
        a = 0
        b = 0
        for i in range(1,len(x)):
            if x[i]=='A':
                a = a + 1
            elif x[i]=='B':
                b = b + 1
        if a > b:
            a = a + 1
        elif a < b:
            b = b + 1
        print(a,b)
except EOFError:
    pass

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0174

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):

    while True:
        data = input().strip()
        if data[0] == '0':
            break

        data = data[1:]
        score_A = data.count('A')
        score_B = data.count('B')

        if score_A > score_B:
            score_A += 1
        else:
            score_B += 1
        print('{} {}'.format(score_A, score_B))



if __name__ == '__main__':
    main(sys.argv[1:])

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

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

Python: while True:
    p = input()
    c = 0
    d = 0
    if p == '0':
        break
    a = len(p)
    for i in range(1,a):
        if p[i] == 'A':
            c += 1
        else:
            d += 1
    if c > d:
        c += 1
    else:
        d += 1
    print(c,d)