import sys

while True:

	for i in range(3):

		game = input()

		if game == "0":sys.exit()

		game = game[1:]+game[-1]

		print(game.count("A"),game.count("B"))
import sys

while 1:

	for i in range(3):

		g=input()

		if g=="0":sys.exit()

		g=g[1:]+g[-1]

		print(g.count("A"),g.count("B"))
import sys

while True:
    for i in range(3):
        game = input()
        if game == "0":
            sys.exit()
        game = game[1:] + game[-1]
        print(game.count("A"), game.count("B"))

import sys

while 1:
    for i in range(3):
        g = input()
        if g == "0":
            sys.exit()
        g = g[1:] + g[-1]
        print(g.count("A"), g.count("B"))

-while True: +while 1: -        game = input() -        if game == "0": +        g = input() +        if g == "0": -        game = game[1:] + game[-1] -        print(game.count("A"), game.count("B")) +        g = g[1:] + g[-1] +        print(g.count("A"), g.count("B"))