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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int main() {
  string in;
  while (cin >> in) {
    if (in == "0") break;
    int i = 1, ct_a = 0, ct_b = 0;
    for (; i < in.size(); ++i) {
      in[i] == 'A' ? ct_a++ : ct_b++;
    }
    ct_a > ct_b ? ct_a++ : ct_b++;
    cout << ct_a << " " << ct_b << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(vs ss(3);cin>>ss[0],ss[0][0]!='0';){
		cin>>ss[1]>>ss[2];
		vector<pii> res(3);
		rep(i,3){
			repi(j,1,ss[i].size())
				if(ss[i][j]=='A')
					res[i].first++;
				else
					res[i].second++;
			if(res[i].first>res[i].second)
				res[i].first++;
			else
				res[i].second++;
			
			cout<<res[i].first<<" "<<res[i].second<<endl;
		}
	}
	
	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(){
    int black[3] = {0};
    int blue[] = { 0,0,255 };
    int lime[] = {0,255,0};
    int aqua[] = {0,255,255};
    int red[] = {255,0,0};
    int fuchsia[] = {255,0,255};
    int yellow[] = {255,255,0};
    int white[] = {255,255,255};
    while(true){
	string s;
	cin >> s;
	if(s == "0") break;
	int rgb[3];
	rgb[0] = stoi(s.substr(1,2),nullptr,16);
	rgb[1] = stoi(s.substr(3,2),nullptr,16);
	rgb[2] = stoi(s.substr(5,2),nullptr,16);
	string ans;
	int m = 10000000;
	int sum = 0;
	REP(j,3) sum += (rgb[j]-black[j])*(rgb[j]-black[j]);
	if(m > sum){
	    m = sum;
	    ans = "black";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-blue[j])*(rgb[j]-blue[j]);
	if(m > sum){
	    m = sum;
	    ans = "blue";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-lime[j])*(rgb[j]-lime[j]);
	if(m > sum){
	    m = sum;
	    ans = "lime";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-aqua[j])*(rgb[j]-aqua[j]);
	if(m > sum){
	    m = sum;
	    ans = "aqua";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-red[j])*(rgb[j]-red[j]);
	if(m > sum){
	    m = sum;
	    ans = "red";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-fuchsia[j])*(rgb[j]-fuchsia[j]);
	if(m > sum){
	m = sum;
	ans = "fuchsia";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-yellow[j])*(rgb[j]-yellow[j]);
	if(m > sum){
	    m = sum;
	    ans = "yellow";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-white[j])*(rgb[j]-white[j]);
	if(m > sum){
	    m = sum;
	    ans = "white";
	}
	cout << ans << endl;
    }
    return 0;
}

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

int main(){
	string game;
	while(cin >> game, game[0] != '0'){
		int a = 0; int b = 0;
		bool serve = true;

		for(int i=1; i < game.length(); i++){
			if(a <= 10 || b <= 10){
				if(game[i] == 'A') a++;
				else b++;
			}
		}
		if(a < b) cout << a << " " << b+1 << endl;
		else cout << a+1 << " " << b << endl;
	}
}

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

int main() {
  string line;
  int s[2];
  while (1) {
    getline(cin, line);
    if (line == "0") break;
    s[0] = s[1] = 0;
    for (int i=1; i<line.length(); i++) {
      ++s[line.at(i) - 'A'];
    }
    if (s[0] > s[1]) ++s[0];
    else ++s[1];
    cout << s[0] << " " << s[1] << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	char buf[3][128];
	while (cin.getline(*buf, sizeof(*buf)), **buf != '0')
	{
		cin.getline(buf[1], sizeof(*buf));
		cin.getline(buf[2], sizeof(*buf));

		int a[3], b[3];
		for (int i = 0; i < 3; ++i)
		{
			a[i] = b[i] = 0;
			for (int j = 1; buf[i][j] != '\0'; ++j)
				if (buf[i][j] == 'A')
					++a[i];
				else
					++b[i];
			if (i < 2)
				if (buf[i+1][0] == 'A')
					++a[i];
				else
					++b[i];
		}
		if (a[2] > b[2])
			++a[2];
		else
			++b[2];
		for (int i = 0; i < 3; ++i)
			printf("%d %d\n", a[i], b[i]);
	}

	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,a=0,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);
	}
}

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

int main()
{
  string s;
  int i, c, score[2];
  while (cin>>s, s!="0") {
    score[0] = 0;
    score[1] = 0;
    c = s[0]-'A';
    for (i = 1; i < s.size(); i++) {
      if (c != s[i]-'A') c ^= 1;
      score[c]++;
    }
    if (score[0]<10) score[1]++;
    else if (score[1]<10) score[0]++;
    else if (score[0]<score[1]) score[1]++;
    else if (score[0]<score[1]) score[1]++;
    else score[0]++;
    cout<<score[0]<<" "<<score[1]<<endl;
  }
}

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

int main(){
	char ta[1000]="",tmp[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 <iostream>
#include <string>
using namespace std;
int main(){
  int cntA,cntB;
  string str;
  while(1){
    cin >> str;
    if(str=="0") break;
    cntA=cntB=0;
    for(int i=1;i<str.size();i++){
      if(str[i]=='A') cntA++;
      else cntB++;
    }
    if(cntA>cntB){
      cout << cntA+1 << ' ' << cntB << endl;
    }else{
      cout << cntA << ' ' << cntB+1 << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string S; int a, b;
int main() {
	while (cin >> S) {
		a = 0; b = 0;
		if (S == "0") { break; }
		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;
	}
}