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<string.h>

using namespace std;

int main(){

  char record[101];
  int play_a;
  int play_b;
  int n;

  while(cin >> record){
    
    if(record[0]=='0')
      break;

    n = strlen(record);
      
    play_a=0;
    play_b=0;
    
    for(int i=1; i<n; i++){
      if(record[i]=='A'){
	play_a++;
      } else {
	play_b++;
      }
    }
    
    if(play_a>play_b){
      play_a++;
    } else {
      play_b++;
    }
    
    cout << play_a << " " << play_b << endl;
  }
}

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

int main(){
	char game[101];
	cin>>game;
	int m;int n;
	while(game[0]!='0'){
		m=0;n=0;
		for(int i=1;game[i]!='\0';i++){
			if(game[i]=='A'){
				 m++;
			}
			else if(game[i]=='B'){
				n++;
			}
		}
		if(m>n){
			cout<<m+1<<' '<<n<<endl;
		}
		else if(m<n){
			cout<<m<<' '<<n+1<<endl;
		}
		cin>>game;
	}

	return 0;
}

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

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,cnt,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(){

  string record;
  
  while(1){

	int a=0;
	int b=0;
	
	cin>>record;

	if(record == "0")
	  break;

	bool flag = false; 
	
	for(int i=0;i<record.size()-1;++i){
	  if(record[i] == record[i+1] && record[i] == 'A')
		a++;
	  else if(record[i] == record[i+1] && record[i] == 'B')
		b++;
	  else if(record[i] != record[i+1] && record[i] == 'A')
		b++;
	  else if(record[i] != record[i+1] && record[i] == 'B')
		a++;

	  if(flag == false && (a == 11 || b == 11))
		break;

	  if(flag == true && (a-b == 2 || b-a == 2))
		break;
	  
	  if(a == 10 & b == 10)
		flag =true;

	}

	if(a > b) a++;
	else b++;
	
	cout<<a<<" "<<b<<endl;
	
  }
  
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    for(string line; cin >> line && line != "0";)
	{
		int a = count(line.begin() + 1, line.end(), 'A');
		int b = line.size() - a - 1;

		(a > b ? a : b) += 1;
		
		cout << a << " " << b << endl;
	}
}

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

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

int main(){
	string serve;
	int APoint = 0;
	int BPoint = 0;
	while(true){
		cin >> serve;
		if(serve == "0"){
			break;
		}
		int size = serve.size();
		APoint = 0;
		BPoint = 0;
		
		for(int i=1;i<size;i++){
			if(serve[i] == 'A'){
				APoint++;
			}else if(serve[i] == 'B'){
				BPoint++;
			}
		}
		
		if(APoint > BPoint){
			APoint++;
		}else{
			BPoint++;
		}
		
		cout << APoint << ' ' << BPoint << '\n';
	}
	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)break;
	a=b=0;
		for(int j=(i>=1);ta[j]!='\0';j++){
		(ta[j]=='A')?a++:b++;
		}
		(a>b)?a++:b++;
		cout<<" "<<a<<" "<<b<<endl;
	}
	}


	return 0;
}

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

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(){
        for(;j<str.size();j++){
            counta=0;countb=0;
            if(str[j]=='A'){
                counta++;
            }
            else{
                countb++;
            }
        }
        if(counta<countb){
            counta=10;countb=12;
        }
        else{
            counta=12;countb=10;
        }
    
    return;
}