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
		}
	}
}

C++: #include<iostream>
using namespace std;

int main(void){
	string s;
	int a[2];
	for(;;){
		cin >> s;
		if(s[0] == '0')break;
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		cin >> s;
		++a[s[0] - 'A'];
		printf("%d %d\n", a[0], a[1]);
		
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		cin >> s;
		++a[s[0] - 'A'];
		printf("%d %d\n", a[0], a[1]);
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		if(a[0] == 10 && a[1] < 10)++a[0];
		if(a[1] == 10 && a[0] < 10)++a[1];
		if(a[0] >= 10 && a[1] >= 10)++a[a[0] < a[1]];
		printf("%d %d\n", a[0], a[1]);
	}
}

C++: #include <string>
#include <iostream>

#include <string.h>

using namespace std;

int main()
{
	const int DATASETS = 1000;

	int A[DATASETS], B[DATASETS], C = 0;

	string S[DATASETS];

	memset(A, 0, sizeof(A));
	memset(B, 0, sizeof(B));

	while (true)
	{
		cin >> S[C];

		if (S[C] == "0") { goto Exit; }

		for (string::size_type i = 0; i < S[C].size(); i++)
		{
			if (S[C][i] == 'A') { A[C]++; }
			if (S[C][i] == 'B') { B[C]++; }
		}

		C++;
	}

Exit:;

	for (int i = 0; i < C; i++)
	{
		cout << A[i] << ' ' << B[i] << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main(void)
{
	int i,j,x[10][10];
	char re[30][30];
	while(1){
		scanf("%s",re[0]);
		if(re[0][0]=='0') break;
		for(i=0;i<3;i++){
			for(j=0;j<2;j++){
				x[i][j]=0;
			}
		}
		for(i=1;i<3;i++){
			scanf("%s",re[i]);
		}
		for(i=0;i<3;i++){
			for(j=1;j<strlen(re[i]);j++){
				if(re[i][j]=='A') x[i][0]++;
				else x[i][1]++;
			}
			if(x[i][0]<x[i][1]) x[i][1]++;
			else x[i][0]++;
		}
		for(i=0;i<3;i++){
			for(j=0;j<2;j++){
				printf("%d",x[i][j]);
				if(j==0) printf(" ");
				else printf("\n");
			}
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  string s[3];
  while(cin >> s[0], s[0] != "0"){
    cin >> s[1] >> s[2];
    for(int x=0;x<3;x++){
      int a=0, b=0;
      for(int i=1;i<(int)s[x].size();i++){
        if(s[x][i] == 'A')a++;
        else b++;
      }
      if(a>b)a++;
      else b++;
      cout << a << " " << b << endl;
    }
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){

  int len, cnt[2];
  string str;

  while(getline(cin, str)){
    len = str.length();
    if(len == 1) break;
    fill(cnt, cnt+2, 0);

    for(int i=1; i<len; i++){
      if(str[i] == 'A') cnt[0]++;
      else cnt[1]++;
    }
    
    cout << cnt[0] << " " << cnt[1] << endl;
  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  string str;
  while(cin >> str,str[0]-'0'){
    int a=0,b=0;
    for(int i=1; i<str.size(); ++i){
      if(str[i]=='A')++a;
      if(str[i]=='B')++b;
    }
    if(a>b){++a;}else{++b;}
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;

int main(){
  int n,num,ap,bp;
  string str;
  while(1){
    ap =bp =0;
    getline(cin,str);
    if(str[0] == '0') return 0;
    for(int i = 1;i < str.length(); i++){
      if(str[i] == 'A')
	ap++;
      else 
	bp++;
    }
    if(ap > bp)
      ap++;
    else 
      bp++;
    cout << ap << " " << bp <<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;

int main(){
	string game;
	while(cin >> game, game[0] != '0'){
		int a = 0; int b = 0;

		for(int i=1; i < game.length(); i++){
			if(a <= 10 || b <= 10){
				if(game[i] == 'A') a++;
				else b++;
			}
		}
		if(a < b) cout << a << " " << b+1 << endl;
		else cout << a+1 << " " << b << endl;

		for(int j=0; j < 2; j++){
			cin >> game;
			a = 0, b = 0;

			for(int i=1; i < game.length(); i++){
				if(a <= 10 || b <= 10){
					if(game[i] == 'A') a++;
					else b++;
				}
			}
			if(a < b) cout << a << " " << b+1 << endl;
			else cout << a+1 << " " << b << endl;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
  string s;
  while(cin >> s, s!="0") {
    int a = count(s.begin()+1,s.end(),'A');
    int b = count(s.begin()+1,s.end(),'B');
    if(a>b) a++;
    else b++;
    cout << a << ' ' << b << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;

int main()
{
  string s;
  int a, b;
  while(true)
  {
    for(int i = 0; i < 3; i++)
    {
      a = b = 0;
      cin >> s;
      if(s[0] == '0')
        return 0;

      for(int j = 1; j < s.length(); j++)
      {
        if(s[j] == 'A')
          a++;
        else
          b++;
      }
      if(a > b)
        a++;
      else
        b++;
      cout << a << " " << b << endl;
    }
  }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    string str;
    while (cin>>str, str != "0") {
        int a = 0;
        int b = 0;
        str.erase(str.begin());
        for (char s : str) {
            if (s == 'A') a++;
            if (s == 'B') b++;
        }
        if (a > b) a++;
        else b++;
        cout << a << " " << b << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	while(1){
		string str;
		int a[2]={0,0};
		cin >> str;
		if(str=="0")break;
		for(int i=0;i<str.size();i++){
			a[str[i]-'A']++;
		}
		printf("%d %d\n",a[0],a[1]);
	}
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main(){

string P;
//for(int i=0;i<3;i++){
while(1){
cin>>P;if(P[0]=='0')break;
int a=0,b=0;
for(int j=0;j<P.size();j++){
if(j>0&&P[j]=='A')a++;
else if(j>0&&P[j]=='B'){b++;}
}

if(a>b)a++;
else if(b>a)b++;

cout<<a<<" "<<b<<endl;
}
return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;

int main(){
	while(true){
		char S[101];
		cin >> S;
		if(S[0]=='0')
			break;
		int countA=0;
		int countB=0;
		
		for(int i=1;S[i]!='\0';i++){
			if(S[i]=='A')
				countA++;
			else if(S[i]=='B')
				countB++;
		}
		if(countA > countB)
			countA++;
		else if(countA < countB)
			countB++;

		cout << countA <<' '<< countB<<endl;
	}
	return 0;
}

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	while(1){
		char str[128];
		scanf("%s", str);
		if(str[0] == '0'){
			break;
		}
		int n = strlen(str);
		int a = 0, b = 0;
		reep(i, 1, n){
			++(str[i] == 'A' ? a : b);
		}
		++(a > b ? a : b);
		printf("%d %d\n", a, b);
	}

	return 0;
}