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() {

  int game_num = 0;

  while (1) {

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

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

      if (i == 0 && game_num != 0) {
        if (in[i+1] == 'A') {
          num_a++;
        }  else if (in[i+1] == 'B') {
          num_b++;
        }
        continue;
      }

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

    }

    if (num_a == 11 && num_b == 11) {
      if (in[in.size()-1] == 'A') {
        num_a++;
        num_b--;
      }  else if (in[in.size()-1] == 'B') {
        num_a--;
        num_b++;
      }
    }
    cout << num_a << " " << num_b << endl;
    game_num++;
    if (game_num == 3) game_num = 0;
  }

	return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	string s[3];
	
	while(cin>>s[0],s[0]!="0"){
		cin>>s[1]>>s[2];
		int a[3]={0};
		int b[3]={0};
		
		for(int j=0;j<3;j++){
		for(int i=1;i<s[j].size();i++){
			if(s[j][i]=='A')
				a[j]++;
			else
				b[j]++;
		}
			if(a[j]>b[j])
				a[j]++;
			else
				b[j]++;
		}
		
		for(int i=0;i<3;i++)
			cout<<a[i]<<" "<<b[i]<<endl;
		
	}
}

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

int main(){

	std::string all, str;
	while (std::cin >> str){
		if (str == "0")break;
		all += str;
	}


	int a = 0, b = 0;
	for (int i = 0; i < all.size() - 1; i++){
		if (all[i + 1] == 'A')a++;
		else b++;

		if (a == 10 || b == 10){
			if (a == 12 || b == 12){
				std::cout << a << " " << b << std::endl;
				a = 0, b = 0;
			}
		}

		else if (a == 11 || b == 11){
			std::cout << a << " " << b << std::endl;
			a = 0, b = 0;
		}

	}

	a > b ? a++ : b++;

	std::cout << a << " " << b << std::endl;

	return 0;
}

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

int main(){
 
 char servepoint[101];

 int Apoint,Bpoint;

 while(1){

   cin >> servepoint;
 
   if(servepoint[0] == '0') break;

   int i;

   i = 1;
 
   while(1){
       
       if(servepoint[i] =='\0') {

            if(Apoint >= 10 && Bpoint >= 10){

              if(servepoint[i-1]=='A') {Apoint++;}
          
              else Bpoint++;
             }

            else if(Apoint == 10 && Bpoint !=10) Apoint ++;
            else if(Bpoint == 10 && Apoint !=10) Bpoint ++;
  
           break;
       } 

       if(servepoint[i] == 'A') Apoint++;
     
       else if(servepoint[i] == 'B') Bpoint++;

      /* if(Apoint==10 && Bpoint !=10) break;
 
       else if (Apoint!=10 && Bpoint ==10) break;

       if(Apoint>=10&&Bpoint>=10){
     
          if(Apoint - Bpoint == 2 || Bpoint - Apoint == 2) break;
        } */
       
       i++;
    }

   

   cout << Apoint <<" "<< Bpoint <<endl;

   Apoint = 0; Bpoint = 0;

 }

 return 0;

}

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

int main()
{
while(1){
	char s[100];
	int a=0,b=0,i,j;

	cin >> s;
if(s[0]=='0'&&s[1]=='\0')break;

		if(s[0]=='A')a=a-1;
		if(s[0]=='B')b=b-1;	
for(i=0;s[i]!='\0';i++){
		if(s[i]=='A')a=a+1;
		
		if(s[i]=='B')b=b+1;
		
if(a==10&&b!=10)break;
if(b==10&&a!=10)break;
}
if(a>b){a=a+1;
}else{ b=b+1;}


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

}

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

using namespace std;

int main(void){

  string s;
  while( cin >> s , s[0] != '0' ){

    int a = 0 ,b = 0;
    char ans;
    for( int i = 1 ; i < s.size() ; 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 <cstdio>
#include <cctype>
#include <utility>
#include <string>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char buf[20];char *p=buf;if(n<0)pcu('-'),n*=-1;
	if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10; while (p!=buf)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

int main() {
	for (char c; c = gcu(), c != '0';) {
		string s; scan(s);
		int A = count(s.begin(), s.end(), 'A'),
			B = s.size() - A;
		(A > B ? A : B)++;
		outl(A, ' ', B);
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(void){
    
    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 if(game[i] == 'B') B++;
        }
        
        if(A>B)A++;
        else B++;
        
        cout << A << " " << B << endl;
    }
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  int as,bs;
  char s[101];
  char sf,f;
  cin >> sf;
  for(int i=0;i<=100;i++) s[i] = '0';
  while(cin>>s){
    cin >> f;
    as = 0;
    bs = 0;
    for(int i=0;i<strlen(s);i++){
      if(s[i]=='A') as++;
      else bs++;
    }
    if(f=='0'){
      if(as>bs) as++;
      else bs++;
    } 
    else if(f=='A') as++;
    else bs++;
    cout << as << ' ' << bs << endl;
    for(int i=0;i<=100;i++) s[i] = '0';
  }
  return 0;
}

C++: #include<iostream>

char service[3][101];
int point[2];

void solve(int n){
	point[0]=0;
	point[1]=0;
	for(int i=1; service[n][i]!='\0'; i++){
		if(service[n][i]=='A')
			point[0]++;
		else
			point[1]++;
	}
	if(point[0]>point[1])
		point[0]++;
	else
		point[1]++;
}

int main(){
	while(true){
		for(int i=0; i<3; i++){
			std::cin >> service[i];
			if(service[0][0] == '0')
				return 0;
		}
		for(int i=0; i<3; i++){
			solve(i);
			std::cout << point[0] << ' ' << point[1] << std::endl;
		}
	}
}

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