while True:

    try:

        for i in range(3):

            line = input().strip()

            if line == '0':

                raise Exception



            a = b = 0

            for i, s in enumerate(line):

                if i != 0:

                    if s == 'A':

                        a += 1

                    else:

                        b += 1

            if a > b:

                a += 1

            else:

                b += 1

            print(a, b)



    except:

        break
while True:

    try:

        for i in range(3):

            line = input().strip()

            if line == '0':

                raise Exception



            if line[0] == 'A':

                a = -1

                b = 0

            else:

                a = 0

                b = -1

            for i, s in enumerate(line):

                if s == 'A':

                    a += 1

                else:

                    b += 1

            if a > b:

                a += 1

            else:

                b += 1

            print(a, b)



    except:

        break
while True:
    try:
        for i in range(3):
            line = input().strip()
            if line == "0":
                raise Exception
            a = b = 0
            for i, s in enumerate(line):
                if i != 0:
                    if s == "A":
                        a += 1
                    else:
                        b += 1
            if a > b:
                a += 1
            else:
                b += 1
            print(a, b)
    except:
        break

while True:
    try:
        for i in range(3):
            line = input().strip()
            if line == "0":
                raise Exception
            if line[0] == "A":
                a = -1
                b = 0
            else:
                a = 0
                b = -1
            for i, s in enumerate(line):
                if s == "A":
                    a += 1
                else:
                    b += 1
            if a > b:
                a += 1
            else:
                b += 1
            print(a, b)
    except:
        break

-            a = b = 0 +            if line[0] == "A": +                a = -1 +                b = 0 +            else: +                a = 0 +                b = -1 -                if i != 0: -                    if s == "A": -                        a += 1 -                    else: -                        b += 1 +                if s == "A": +                    a += 1 +                else: +                    b += 1