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<stdio.h>
#include<string.h>
int main(void)
{
	char str1[100];
	int A,B,n,i;
	
	while(1)	{
		scanf("%s",str1);
		
		if(str1[0]='0')	{
			break;
		}
		n=strlen(str1);
		A=0;
		B=0;
		for(i=1;i<n;i++)	{
			if(str1[i]='A')	{
				A++;
			}
			if(str1[i]='B')	{
				B++;
			}
		}
		
		if(A > B) {
			printf("%s%d %s%d\n",A+1,B);
		}
		else if(A < B) {
			printf("%s%d %s%d\n",A,B+1);
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>

int main(){
	char ss[110];
	int i,j,a,b;
	
	while(~scanf(" %s ",ss)){
		if(ss[0]=='0')break;
		i=1;
		a=0;
		b=0;
		while(1){
			if(ss[i]=='\0')break;
			if(ss[i]=='A')++a;
			if(ss[i]=='B')++b;
			++i;
		}
		if(a>b){
			++a;
		}else{
			++b;
		}
		printf("%d %d\n",a,b);
	}
	return 0;
}

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

int main(){
	char ta[1000];
	int a,b;

	while(true){
	for(int i=0;i<3;i++){
	cin>>ta;
	if(strcmp(ta,"0")==0)return 0;
	a=b=0;
		for(int j=1;ta[j]!='\0';j++){
		(ta[j]=='A')?a++:b++;
		}
		(a>b)?a++:b++;
		cout<<" "<<a<<" "<<b<<endl;
	}
	}


	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
 string c;
 while(true){
 cin>>c;
 if(c=="0")
 break;
 int a=0,b=0;
 for(int i=1;i<c.size();i++){
  if(c[i]=='A')
  a++;
  if(c[i]=='B')
  b++;
 }
 if(a>b)
 a++;
 if(a<b)
 b++;
 cout<<a<<" "<<b<<endl;
 }
 return 0;   
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  
  string game;
  while(cin >> game) {
    if(game == "0") break;
    
    int cntA = 0;
    int cntB = 0;
    
    int const N = game.size();
    for(int i=0; i<N; i++) {
      cntA += game[i] == 'A';
      cntB += game[i] == 'B';
    }
    
    cout << cntA << ' ' << cntB << endl;
      
    for(int I=0; I<2; I++) {
      
      cin >> game;
      
      cntA = 0, cntB = 0;
      
      game = game.substr(1);
      
      int const N = game.size();
      for(int i=0; i<N; i++) {
	cntA += game[i] == 'A';
	cntB += game[i] == 'B';
      }
      
      if(cntA > cntB) {
	if(cntA >= 11) {
	  cntA = cntB + 2;
	}
	else {
	  cntA = 11;
	}
      }
      else {
	if(cntB >= 11) {
	  cntB = cntA + 2;
	}
	else {
	  cntB = 11;
	}
      }
    
      cout << cntA << ' ' << cntB << endl;
      
    }
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    string s;
    cin >> s;
    while(true){
	if(s == "0") break;
	int a,b;
	a = 0;
	b = 0;
	for(int i=1;i<s.size();i++){
	    if(s[i] == 'A'){
		a++;
	    }else{
		b++;
	    }
	}
	cin >> s;
	if(s[0] == 'A') a++;
	else if(s[0] == 'B') b++;
	else if(s[0] == '0'){
	    if(a >= 10 && b >= 10){
		if(a > b){
		    a++;
		}else{
		    b++;
		}
	    }else{
		if(a > b) a = 11;
		else b = 11;
	    }
	}
	printf("%d %d\n",a,b);
    }
    return 0;
}

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

int main(){
char bad[101];
cin>>bad;
int a,b;
while(bad[0]!=0&&bad[1]!='\0'){
a=0;
b=0;
for(int i=1;i<101;i++){
	if(bad[i]=='A'){
	a++;
	}else if(bad[i]=='B'){
		b++;
		}
	}
	if(a>b){
		a++;
	}else if(b>a){
		b++;
	}
cout << a << ' ' << b << endl;
for(int k=0;k<101;k++){
		bad[k]='\0';
		}
	cin >> bad;
	}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	while(1){
		int a=0,b=0;
		bool server=true;
		cin>>s;
		if(s=="0")break;
		for(int i=1;i<s.size();i++){
			if(s[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		cout<<a<<" "<<b<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main() {
    string set;
    while (cin >> set) {
        if (set == "0") break;
        int a = 0, b = 0;
        for (int i=1; i<set.length(); i++) {
            if (set[i] == 'A') a++;
            if (set[i] == 'B') b++;
        }
        if (a > b) a++;
        else if (a < b) b++;
        cout << a << " " << b << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(void){
	string s;
	while(cin>>s,s!="0"){
		for(int i=0;i<3;++i){
			if(i)cin>>s;
			int a=0,b=0;
			for(int j=1;j<s.size();++j){
				if(s[j]=='A') ++a;else ++b;
			}
			if(a>b) ++a;else ++b;
			cout<<a<<" "<<b<<endl;
		}
	}
	return 0;
}

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

int main() {

  while (1) {

    string in;
    cin >> in;
    if (in == "0") break;

    int num_a = 0, num_b = 0;
    for (int i = 1; i < in.size(); i++) {

      if (in[i] == 'A') num_a++;
      else if (in[i] == 'B') num_b++;

    }

    if (num_a > num_b) num_a++;
    else if (num_b > num_a) num_b++;

    cout << num_a << " " << num_b << endl;
  }

	return 0;
}

C++: // 2011/08/16 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	while(true){
		string srv;
		cin >> srv;
		if(srv=="0")		// ツ閉カツ篠堋療ア
			break;

		int ptA = 0;
		int ptB = 0;
		for(int i=1; i<srv.size(); i++)
			if(srv[i]=='A')
				ptA++;
			else
				ptB++;

		if(ptA>ptB)
			ptA++;
		else
			ptB++;

		cout << ptA << ' ' << ptB << endl;
	}

	return 0;
}

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

int main() {
    for(string line; getline(cin, line), line != "0"; ) {
        int sa = 0, sb = 0;
        for(int i = 1; i < (int)line.length(); i++) {
            (line[i] == 'A' ? sa : sb)++;
        }
        if(sa >= 10 && sb >= 10) {
            (sa > sb ? sa : sb)++;
            cout << sa << ' ' << sb << endl;
        }
        else {
            (sa == 10 ? sa : sb)++;
            cout << sa << ' ' << sb << endl;
        }
    }
}

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

main(){
    string game;
    while( cin >> game && game != "0") {
	int A = 0, B = 0;
	for ( int i = 1; i < game.size(); i++ ) {
	    if ( game[i] == 'A' ) A++;
	    else B++;
	}
	(A > B) ? A++ : B++;
	cout << A << " " << B << endl;
    }
}

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

int main() {

  string s;
  while(true) {

    cin>>s;
    if( s == "0" ) break;

    int a=0,b=0;
    for(int i=1; i<s.length(); i++) {
      if( s[i] == 'A' ) a++;
      else b++;
    }

    ( a > b ) ? a++ : b++;

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

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=1;i<str.size();i++){
			a[str[i]-'A']++;
		}
		if(a[0]>a[1])a[0]++;
		else a[1]++;
		printf("%d %d\n",a[0],a[1]);
	}
    return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	char z[1000];
	while(1){
		s=0;
		d=0;
		scanf("%s",z);
		a=strlen(z);
		if(z[0]=='0') break;
		for(i=1;i<a;i++){
			if(z[i]=='A') s++;
			if(z[i]=='B') d++;
		}
		if(s<d) d++;
		else s++;
		printf("%d %d\n",s,d);
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;
int main(){
char bad[101];
cin >> bad;
int a,b;
while(bad[0]!=0&&bad[1]!='\0'){
 a=0;b=0;
 for(int i=1;i<101;i++){
      if(bad[i]=='A'){
            a++;
       }else if(bad[i]=='B'){
            b++;
        }
  }
  if(a>b){
    a++;
  }else if(b>a){
    b++;
  }
  cout << a << ' ' << b << endl;
  for(int k=0;k<101;k++){
      bad[k]='\0';
  }
  cin >> bad;
}

return 0;
}