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()
{
 while(1){
 char str[150];
 int pointA=0;
 int pointB=0;
 int j=1;
 cin>>str;
 if(str[0]=='0'){break;}
 while(str[j]!='\0'){
	if(str[j]=='A'){
		pointA++;}
	if(str[j]=='B'){
		pointB++;}
	j++;
 }
 if(pointA>pointB)pointA++;
 if(pointA<pointB)pointB++;
 cout<<pointA<<' '<<pointB<<'\n';
 }
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;
  while(1){
  int i=1;
   if(S[i]=='A') a++;
   if(S[i]=='B') b++; 
   if(a==10&&b!=10){
    a++;
    break;
   }
   if(b==10&&a!=10){
    b++;
    break;
   }
  i++;
  }
  cout<<a<<' '<<b<<endl;
  a=0;b=0;
 }  

 return 0;

}

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

int main() {
  string record;
  while (true) {
    cin >> record;
    if (record[0]=='0') {
      break;
    }
    int a = 0, b = 0;
    for (int j=0; j<record.size(); j++) {
      if (j>0 && record[j]=='A') {
	a++;
      } else if (j>0 && record[j]=='B') {
	b++;
      }
    }
    if (a>b) {
      a++;
    } else if (b>a) {
      b++;
    }
    cout << a << " " << b << endl;
  }
  return 0;
}

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

int main(){

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

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

		a>b ? a++ : b++;
		std::cout << a << " " << b << std::endl;

	}

	return 0;
}

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

using namespace std;

pair<int, int> solve(string S)
{
    int a = 0, b = 0;
    
    for(int i = 1; i < S.size(); i++)
    {
        if(S[i] == 'A')
        {
            a++;
        }
        else
        {
            b++;
        }
    }
    
    if(a == 10 && a > b) { a++; }
    else if(b == 10 && b < a) { b++; }
    else if(a > b) { a++; }
    else if(a < b) { b++; }
    
    return make_pair(a, b);
}

int main()
{
    while(true)
    {
        string S1, S2, S3;
        
        cin >> S1;
        
        if(S1 == "0") { break; }
        
        cin >> S2 >> S3;
        
        cout << solve(S1).first << ' ' << solve(S1).second << endl;
        cout << solve(S2).first << ' ' << solve(S2).second << endl;
        cout << solve(S3).first << ' ' << solve(S3).second << 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(){
        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;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
  string str;
  while(cin >> str, str[0] - '0'){
    map<char, int> p;
    p['A'] = 0; p['B'] = 0;
    for(int i=1; i < str.length(); i++){
      p[str[i]]++;
    }
    if(p['A'] >= 10 && p['B'] >= 10){
      p[*(str.end()-1)]++;
      cout << p['A'] << " " << p['B'] << endl;
    }else if(p['A'] == 10){
      p['A']++;
      cout << p['A'] << " " << p['B'] << endl;
    }else if(p['B'] == 10){
      p['B']++;
      cout << p['A'] << " " << p['B'] << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>

#define MAX(x, y) ((x) > (y) ? (x) : (y))

int main(void)
{
	char game[3][256];
	int score[2];
	
	while (1){
		for (int i = 0; i < 3; i++){
			scanf("%s", game[i]);
			if (game[0][0] == '0') return (0);
		}
		
		for (int i = 0; i < 3; i++){
			score[0] = score[1] = 0;
			for (int j = 1; game[i][j] != '\0'; j++){
				if (game[i][j] == 'A'){
					score[0]++;
				}
				else {
					score[1]++;
				}
			}
			MAX(score[0], score[1])++;
			
			printf("%d %d\n", score[0], score[1]);
		}
	}
	
	return (0);
}

C++: #include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int p[3][2];
string game[3];

void poyo() {
	memset(p, 0, sizeof(p));
	
	for_(i,0,3) {
		if (i != 0) ++p[i - 1][game[i][0] - 'A'];
		int len = game[i].size();	
		for_(j,1,len) ++p[i][game[i][j] - 'A'];
	}
	
	for_(i,0,3) {
		cout << p[i][0] + (i == 2 ? p[i][0] > p[i][1] : 0) << " " << p[i][1] + (i == 2 ? p[i][0] < p[i][1] : 0) << endl;
	}
}

int main() {
	while (cin >> game[0] >> game[1] >> game[2]) poyo();
}

C++: #include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void) {
  char ser[100];
  int serlen;
  int a=0, b=0;

  while(scanf("%s", ser) != 0) {
    serlen = strlen(ser);
    for(int i = 1 ; i < serlen ; i++) {
      if(ser[i] == 'A') a++;
      else if(ser[i] == 'B') b++;
      //cout << a << ' ' << b << endl;
    }
    if(a > b) a++;
    else if(b > a) b++;
    if(a == 0 && b == 0) break;
    cout << a << ' ' << b << endl;
    a = 0; b = 0;
  }
  return 0;
}

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

int main()
{
	char serve[100];

	while (cin >> serve, serve[0] != '0'){
		int pt[2] = {0};
		for (int i = 0; i < strlen(serve) - 1; i++){
			if (serve[i] != serve[i + 1]){
				pt[serve[i + 1] - 'A']++;
			}
			else {
				pt[serve[i] - 'A']++;
			}
		}
		pt[serve[strlen(serve) - 1] - 'A']++; 
		cout << pt[0] << " " << pt[1] << endl;
	}

	return (0);
}

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

C++: #include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;
bool isPrime(int num);

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