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>
using namespace std;

int main(){
	string ss;
	while(cin>>ss){
		if(ss=="0")break;
		int apo=0,bpo=0;
		for(int i=1;i<ss.size();i++){
			if(ss[i]=='A'){
				apo++;
			}else{
				bpo++;
			}
		}
		if(apo<=10 ||bpo<=10){
			if(apo>bpo){
				apo++;
			}else if(bpo>apo){
				bpo++;
			}
		}
		cout<<apo<<" "<<bpo<<endl;
	}
	return 0;
}

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

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

int main() {
	char d[101];
	int i,j,a,b;
	while(true) {
	for (i=0;i<3;i++) {
		cin >> d; a=b=0;
		if (d[0]=='0') return 0;
		for (j=1;d[j]!='\0';j++) if (d[j]=='A') a++; else b++;
		if (a>b) a++; else b++;
		cout << a << ' ' << b << endl; 
	}
}  
	return 0;
}

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

int main() {
	int a,b;
	string s;
	while(cin>>s,s[0]!='0'){
		a=b=0;
		for(int i=0;i<s.size();i++){
			if(s[i]=='A')a++;
			else b++;
		}
		if(a!=11||b!=11){
			if(a==10){a++;b--;}
			if(b==10){a--;b++;}
		}
		if(a==11&&b==11){
			if(s[s.size()]=='A'){a++;b--;}
			else{a--;b++;}
		}
		cout<<a<<" "<<b<<endl;
			
	}
	return 0;
}

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

using namespace std;

void solve(string s){
    int a[2] = {};
    for(int i = 1; i < s.size(); i++){
        a[s[i]-'A']++;
    }
    a[0]<a[1] ? a[1]++ : a[0]++;
    cout << a[0] << " " << a[1] << endl;

}


int main(){
    string s;
    while(cin >> s, s != "0"){
        solve(s);
        cin >> s;
        solve(s);
        cin >> s;
        solve(s);
    }
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "0")
            return 0;

        int n = s.size();
        int a = count(s.begin()+1, s.end(), 'A');
        int b = n - a - 1;
        if(a > b)
            ++ a;
        else
            ++ b;

        cout << a << ' ' << b << endl;
    }
}

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

//カウントしていくだけの作業
//ただ、最後の試合はどちらが勝ったのか表記されないので注意

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

		for(int i=1; i < game.length(); i++){
			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.h>

using namespace std;

int main(){

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

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

    n = strlen(record);
      
    count=0;
    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++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < ((k)+(n)); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 
template <class _Tv> inline string join(const _Tv &v,string sep=" "){
    ostringstream s;FOREACH(it,v){if(it!=v.begin())s<<sep;s<<*it;};return s.str();
}

typedef long long ll;
typedef unsigned long long ull;
typedef double D;
typedef complex<D> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define X real()
#define Y imag()
#define EPS (1e-9)
#define DEQ(p1,p2) (abs((p1)-(p2)) < EPS)

#ifdef _DEBUG
template<class _Tv> inline void _prfe(const char *_n,const _Tv _c,bool _p=false){
    ITER(_c) _it=_c.begin();
    if(_p){cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{cout<<_n<<" = [ ";if(_c.size()){cout<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;}cout<<" ]"<<endl; }
}
ostream &operator<<(ostream &os, const pair<int,int> &p){return(os<<"("<<p.first<<","<<p.second<<")");}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

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

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

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

C++: // 2014/05/20 Tazoe

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	while(true){
		char s[101];
		cin >> s;

		if(strcmp(s, "0")==0)
			break;

		int A = 0, B = 0;

		for(int i=1; s[i]!='\0'; i++){
			if(s[i]=='A'){
				A++;
			}
			else{
				B++;
			}
		}

		if(A>B){
			A++;
		}
		else{
			B++;
		}

		cout << A << ' ' << B << '\n';
	}

	return 0;
}