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++: #define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 1e-8;

int main(){
	string str;
	bool isA = true;
	while(cin >> str){
		if(str.size() == 1 && str[0] == '0') break;
		int A = isA ? count(str.begin(),str.end(),'A') - 1 : count(str.begin(),str.end(),'A');
		int B = isA ? count(str.begin(),str.end(),'B') : count(str.begin(),str.end(),'B') - 1;
		printf("%d %d\n",A > B ? A+1 : A, B > A ? B+1 : B);
		isA = A > B ? true : false;
	}
}

C++: // 2015/06/01 Tazoe

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

int main()
{
	while(true){
		char s[150];
		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;
}

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

int main()
{
 for(int i=0;i<3;i++){
 char str[150];
 int pointA=0;
 int pointB=0;
 int j=1;
 cin>>str;
 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>
#include<string>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    string s;
    while(cin >> s, s[0] != '0'){
        int l = 0, r = 0;
        int i = 1;
        if(s[0] == '0') break;
        while(s[i]){
            if(s[i++] == 'A') l++;
            else r++;
        }
        if(l > r) l++;
        else r++;
        cout << l << ' ' << r << endl;
    }
}

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

using namespace std;

int main(void){
	string str;

	while(cin >> str){
		int n = str.size(),a=0,b=0;
		if(str[0] == '0') break;
		for(int i=0;i<n-1;i++){
			if(str[i] == str[i+1]){
				if(str[i] == 'A'){
					a++;
				}else{
					b++;
				}
			}else{
				if(str[i] == 'A'){
					b++;
				}else{
					a++;
				}
			}
		}
		if(a > b){
			a++;
		}else{
			b++;
		}
		cout << a << " " << b << endl;
	}
}

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

int main() {
	vector<int> a,b;
	while(1){
		string str; cin >> str ;
		if(str=="0"){
			if( a[a.size()-1] > b[b.size()-1] ) a[a.size()-1]++;
			else b[b.size()-1]++;
			break;
		}
		if(str[0]=='A' && a.size()>=1) a[a.size()-1]++;
		else if(str[0]=='B' && b.size()>=1) b[b.size()-1]++;
		int tmp_A=0,tmp_B=0; //score
		a.push_back(0), b.push_back(0);
		for(int i=1;i<str.size();i++){
			if(str[i]=='A') a[a.size()-1]++;
			else if(str[i]=='B') b[b.size()-1]++;
		}
	}
	for(int i=0;i<a.size();i++) cout << a[i] << ' ' << b[i] << '\n' ;
}

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>
#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)return 0;
	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<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
    while(1){
        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;
    }
    return 0;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	vector<P> vec;
	while(1){
		vec.clear();
		string s;
		for(int j=0;j<3;j++){
			cin >> s;
			if(s=="0")goto end;
			if(s[0]=='A'&&!vec.empty())vec.back().fi++;
			else if(s[0]=='B'&&!vec.empty())vec.back().sec++;
			int a = 0,b = 0;
			for(int i=1;i<s.size();i++){
				if(s[i]=='A')a++;
				else b++;
			}
			vec.pb(P(a,b));
		}
		if(vec.back().fi>=10&&vec.back().sec>=10){
			if(vec.back().fi>vec.back().sec)vec.back().fi++;
			else vec.back().sec++;
		}
		else{
			if(vec.back().fi>vec.back().fi)vec.back().fi++;
			else vec.back().sec++;
		}
		for(int i=0;i<vec.size();i++){
			printf("%d %d\n",vec[i].fi,vec[i].sec);
		}
	}
	end:;
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
	string str = "";

	while (getline (cin, str ) ){

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if

		int i;
		int len = str.length();
		int scoreA = 0;
		int scoreB = 0;

		for (i = 1; i < len; ++i){
			if (str[i] == 'A'){
				++scoreA;
			}else{
				++scoreB;
			} // end if
		} // end for

		if (scoreA >= 10 && scoreB < 10 || scoreA < 10 && scoreB >= 10){
				if (scoreA >= 10 && scoreB < 10){
					++scoreA;
				}else{
					++scoreB;
				} // end if
		}else{
			if (abs (scoreA - scoreB) == 1 ){
				if (str[len - 1] == 'A' ){
					++scoreA;
				}else{
					++scoreB;
				} // end if
			} // end if
		} // end if

		cout << scoreA << ':' << scoreB << endl;

	} // end loop

	return 0;
}