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>
#include <cstring>
using namespace std;

int main(){
	char serve[3][101];
	char latestServe;
	int APoint;
	int BPoint;
	bool isDeuce = false;
	while(true){
		cin >> serve[0];
		if(strlen(serve[0]) == 1){
			break;
		}
		cin >> serve[1] >> serve[2];
		APoint = 0;
		BPoint = 0;
		
		for(int i=0;i<3;i++){
			for(int j=1;j<101;j++){
				if(serve[i][j]=='A'){
					APoint++;
				}else if(serve[i][j]=='B'){
					BPoint++;
				}else if(serve[i][j]=='\0'){
					break;
				}
			  latestServe = serve[i][j];
				if(APoint == BPoint && APoint == 10){
					isDeuce = true;
				}
			}
			if(isDeuce){
				if(latestServe == 'A'){
					APoint++;
				}else{
					BPoint++;
				}
			}else{
				if(APoint > BPoint){
					APoint++;
				}else{
					BPoint++;
				}
			}
			isDeuce = false;
			cout << APoint << ' ' << BPoint << '\n';
			APoint = 0;
			BPoint = 0;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int i,j,counta=0,countb=0,bx;
    string str;
    for(i=0;i<20;i++){
            getline(cin,str);
        if(str[1]==0){
            break;
        }
            for(j=0;j<str.size();j++){
                bx={j=0};
                if(i>0&&bx=='A'){
                    counta--;
                }
                else if(i>0&&bx=='B'){
                    countb--;
                }
            if(str[j]=='A'){
                counta++;
            }
            else if(str[j]=='B'){
                countb++;
            }
        }
        cout<<counta<<" "<<countb<<endl;
        counta=0;
        countb=0;
    }
    return 0;
}

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

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

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int len,a1,b1,a2,b2,a3,b3;
  string s;
  for(;;){
    s="";
    cin>>s;
    if(s=="0")
      break;
    len=s.length();
    a1=b1=a2=b2=a3=b3=0;
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a1++;
      else
	b1++;
    }
    if(a1>b1)
      a1++;
    else
      b1++;
    cin>>s;
    len=s.length();
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a2++;
      else
	b2++;
    }
    if(a2>b2)
      a2++;
    else
      b2++;
    cin>>s;
    len=s.length();
    for(i=1;i<len;i++){
      if(s[i]=='A')
	a3++;
      else
	b3++;
    }
    if(a3>b3)
      a3++;
    else
      b3++;
    cout<<a1<<" "<<b1<<endl;
    cout<<a2<<" "<<b2<<endl;
    cout<<a3<<" "<<b3<<endl;
  }
  return 0;
}

C++: 
#include <iostream>
using namespace std;
int main(){
 char S[101];
 int a,b; 
 while(1){
  cin>>S;
  if(S[0]=='0') break;
  a=0; b=0;
  for(int i=1;i<=101;i++){
   if(S[i]=='A') a++;
   if(S[i]=='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 max(int,int);

int main(void){
  char str[200];
  int a,b;
  
  while(1){
    for(int i=0;i<200;i++){
      str[i]='\0';
    }
    scanf("%[^\n]%*c",str);
    a=0;
    b=0;
    if(str[0]=='0')break;
    
    for(int i=1;str[i]!='\0';i++){  
      if(str[i]=='A')a++;
      else if(str[i]=='B')b++;
    }
    
    if(a==max(a,b))a++;
    else if(b==max(a,b))b++;
    cout << a <<" "<< b << endl;
  }
  
  return 0;
}

int max(int x,int y){
  return (x<y)?y:x;
}

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

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

int main(){
	string save;
	while(1){
		cin >> save;
		if(save == "0") break;
		int len = save.size();
		int ac=0,bc=0;
		for(int i=1;i<len;i++){
			if(save[i] == 'A') ac++;
			else bc++;
		}
		if(ac > bc) ac++;
		else bc++;
		cout << ac << " " << bc << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    while(cin >> s)
    {
        if(s == "0") break;
        int a = 0, b = 0;
        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;
    }
    return 0;
}

C++: #include<cstdio>
#include<cstring>
using namespace std;
int main(){
	char str[1024];
	int cnt = -1;
	int a = 0,b = 0;
	while(scanf("%s",str),true){
		if(++cnt % 3 != 0){
			(str[0] == 'A') ? a++ : b++;
			printf("%d %d\n",a,b);
			a = 0,b = 0;
		}
		else if(cnt != 0){
			if(a > b)a++;
			else b++;
			if(str[0] == '0'){
				printf("%d %d\n",a,b);
				break;
			}
			printf("%d %d\n",a,b);
			a = 0,b = 0;
		}
		int len = strlen(str);
		for(int i = 1; i < len; i++){
			(str[i] == 'A') ? a++ : b++;
		}
	}
	return 0;
}

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

int main(){
	string p;
	 while(1){
	 	cin >> p;
	 	if(p[0]=='0'){
	 		return 0;
	 	}
	 	p += '0';
	 	int a=0,b=0;
	 	for(int t=1;p[t]!='0';t++){
	 		if(p[t]=='A'){
	 			a++;
	 		}
	 		if(p[t]=='B'){
	 			b++;
	 		}
	 	}
	 	if((a==10)&&(b<10)){
	 		a++;
	 	}
	 	if((a<10)&&(b==10)){
	 		b++;
	 	}
	 	if((a>9)&&(b>a)){
	 		b++;
	 	}
	 	if((a>b)&&(b>9)){
	 		a++;
	 	}
	 	printf("%d %d\n",a,b);
	 }
}

C++: #define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 1e-8;

int main(){
	string str;
	bool isA = true;
	while(cin >> str){
		if(str.size() == 1 && str[0] == '0') break;
		int A = count(str.begin()+1,str.end(),'A');
		int B = count(str.begin()+1,str.end(),'B');

		if(A > B){
			if(B < 10) A = 11;
			else A = B + 2;			
		}
		else if(B > A){
			if(A < 10) B = 11;
			else B = A + 2;
		}
		printf("%d %d\n",A,B);
	}
}

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

using namespace std;

int max(int,int);

int main(void){
  char str[200];
  int a,b;

  while(1){
    for(int i=0;i<200;i++){
      str[i]='\0';
    }
    scanf("%[^\n]%*c",str);
      a=0;
      b=0;
    if(str[0]=='0')break;
    for(int i=1;str[i]!='\n';i++){

      if(str[i]=='A')a++;
      else if(str[i]=='B')b++;
}

    if(a==max(a,b))a++;
    else if(b==max(a,b))b++;
  cout << a <<" "<< b << endl;
}

  return 0;
}

int max(int x,int y){
  return (x<y)?y:x;
}