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++: // 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 << '\n';
	}

	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){
		    b = a + 2;
		}else{
		    a = b + 2;
		}
	    }else{
		if(a > b) a = 11;
		else b = 11;
	    }
	}
	printf("%d %d\n",a,b);
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


void solve( string s0, string s1, string s2 ) {
    int A0 = 0, A1 = 0, A2 = 0;
    int B0 = 0, B1 = 0, B2 = 0;
    int n0 = s0.size(), n1 = s1.size(), n2 = s2.size();
    for ( int i = 1; i < n0; ++ i ) {
        if ( s0[i] == 'A' ) A0 ++;
        else B0 ++;
    }
    for ( int i = 1; i < n1; ++ i ) {
        if ( s1[i] == 'A' ) A1 ++;
        else B1 ++;
    }
    for ( int i = 1; i < n2; ++ i ) {
        if ( s2[i] == 'A' ) A2 ++;
        else B2 ++;
    }
    if ( s1[0] == 'A' ) A0 ++;
    else B0 ++;
    if ( s2[0] == 'A' ) A1 ++;
    else B1 ++;
    if ( A2 >= 10 && B2 >= 10 ) {
        if ( A2 > B2 ) A2 ++;
        else B2 ++;
    } else if ( A2 > B2 ) {
        A2 ++;
    } else {
        B2 ++;
    }

    cout << A0 << " " << B0 << endl;
    cout << A1 << " " << B1 << endl;
    cout << A2 << " " << B2 << endl;
}

int main() {
    string s0, s1, s2;
    while ( cin >> s0 ) {
        if ( s0 == "0" ) break;
        cin >> s1 >> s2;
        solve( s0, s1, s2 );
    }
    return 0;
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3];
	char sabu[102];
	while(1) {
		cnt=0;
		for(i=0;i<3;i++) {
			cin>>sabu;
			a=b=0;
			if(sabu[0]=='0') {
				cnt=1;
				break;
			}
			for(j=1;j<strlen(sabu);j++) {
				if(sabu[j]=='A') a++;
				else b++;  
				if(a==b&&a>10) a=b=10;
			}
			if(a>b)s1[i]=a+1,s2[i]=b;
			else s1[i]=a,s2[i]=b+1;
		}
		if(cnt==1) break;
		for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl;
	}
	return 0;
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,f=0,cnt=0;
	char sabu[101];
	while(1) {
		f=cnt=0;
		for(i=0;i<3;i++) {
			cin>>sabu;
			a=b=0;
			if(sabu[0]=='0') {
				cnt=1;
				break;
			}
			for(j=1;j<strlen(sabu);j++) {
				if(sabu[j]=='A') a++;
				else b++;  
				if(a==b&&a>10) a=b=10;
			}
			if(a>b)cout<<a+1<<" "<<b<<endl;
			else cout<<a<<" "<<b+1<<endl;
		}
		if(cnt==1) break;
	}
}

C++: //3ゲーム目の最後の得点をどちらがとったのかが分からないので、このときは2点連続同じ人がとったと仮定する。
#include<iostream>
#include<string.h>
using namespace std;

char s[3][102];

int main(){
	int i,j;
	while( cin >> s[0] ){
		if( s[0][0] == '0' )
			break;
		cin >> s[1] >> s[2];
		
		for( i = 0;i < 3;i++ ){
			int cnt[2] = {0};
			for( j = 1;j < strlen( s[i] );j++ ){
				cnt[ s[i][j]-'A' ]++;
			}
			/*if( i == 2 ){
				cnt[ s[i][j-1]-'A' ]++;
			}*/
			else{
				cnt[ s[i+1][0]-'A' ]++;
			}
			cout << cnt[0] << " " << cnt[1] << endl;
		}
	}
	return 0;
}

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

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

int abs(int x) {
  if(x < 0) x *= -1;
  return x;
}

int main() {
  int game = 1;
  while(1) {
    string str;
    getline(cin, str);
    if(str == "0") break;

    int A = 0;
    int B = 0;
    for(int i = 1; i < str.length(); i++) {
      if(str[i] == 'A') A++;
      else if(str[i] == 'B') B++;
    }

    A++;
    if((A >= 11 || B >= 11) && abs(A-B) >= 2) {
    } else {
      A--;
      B++;
    }
    cout << A << ' ' << B << endl;

    game++;
  }
  return 0;
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3];
	char sabu[102];
	while(1) {
		f=cnt=0;
		for(i=0;i<3;i++) {
			cin>>sabu;
			a=b=0;
			if(sabu[0]=='0') {
				cnt=1;
				break;
			}
			for(j=1;j<strlen(sabu);j++) {
				if(sabu[j]=='A') a++;
				else b++;  
				if(a==b&&a>10) a=b=10;
			}
			if(a>b)s1[i]=a+1,s2[i]=b;
			else s1[i]=a,s2[i]=b+1;
		}
		if(cnt==1) break;
		for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl;
		
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
char c[101];
int main(){
	while(scanf("%s",c)){
		if(c[0]=='0')return 0;
		int count=0;
		int a=0;
		int b=0;
		for(int i=1;i<strlen(c);i++){
			if(c[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		printf("%d %d\n",a,b);
	}
}