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

int main(){
	char serve[3][101];
	char latestServe;
	int APoint[3];
	int BPoint[3];
	bool isDeuce = false;
	while(true){
		cin >> serve[0];
		if(strlen(serve) == 1){
			break;
		}
		cin >> serve[1] >> serve[2];
		APoint = 0;
		BPoint = 0;
		
		for(int i=0;i<3;i++){
			for(int j=1;j<101;j++){
				if(serve[i]=='A'){
					APoint[i]++;
				}else if(serve[i]=='B'){
					BPoint[i]++;
				}else if(serve[i]=='\0'){
					break;
				}
			  latestServe = serve[i];
				if(APoint == BPoint && APoint == 10){
					isDeuce = true;
				}
			}
			if(isDeuce){
				if(latestDuce == 'A'){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}else{
				if(APoint[i] > BPoint[i]){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}
			isDeuce = false;
			cout << APoint[i] << ' ' << BPoint[i] << '\n';
		}
	}
	return 0;
}

C++: #include <iostream>

int main()
{
	std::string input;
	while (true) {
		getline(std::cin, input);
		if (input == "0") break;
		int a=0, b=0;
		for (int i=1; i<input.length(); i++) {
			if (input[i] == 'A') a++;
			else b++;
		}
		if (a>b) a++;
		else b++;
		std::cout << a << " " << b << std::endl;
	}
	return 0;
}

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") break;
		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]++;
		}
		if(a[a.size()-1] > b[b.size()-1]) a[a.size()-1]++;
		else b[b.size()-1]++;
	}
	for(int i=0;i<a.size();i++) cout << a[i] << ' ' << b[i] << '\n' ;
}

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

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

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

using namespace std;

int main(void){
	std::ios_base::sync_with_stdio();

	string inp;
	int As,Bs;

	while(1){
		cin>>inp;
		if(inp=="0") break;
		As=0,Bs=0;
		for(int i=1;i<inp.length();i++){
			if(inp[i]=='A') As++;
			else Bs++;
		}
		if(max(As,Bs)==As) As++;
		else Bs++;
		cout<<As<<" "<<Bs<<endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(void) {
  string s;
  while (cin >> s, s != "0") {
    int a = 0, b = 0;
    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;
  }
  
  return 0;
}

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;

		if(A > B && A+1 >= 12){
			printf("%d %d\n",12,10);
		}
		else if(B > A && B+1>=12){
			printf("%d %d\n",10,12);
		}
		else{
			printf("%d %d\n",A>B ? A+1 : A,B>A ? B+1 : B);
		}
		isA = A > B ? true : false;
	}
}

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

int main(){
  string str;
  
  for(;;){
    int cntA = 0,cntB = 0;
  
    cin >> str;
    if(str == '0') break;
    
    for(int i = 1 ; i < str.size() ; i++){
      if(str[i] == 'A') cntA++;
      else cntB++;    
    }
    
    if(cntA > cntB) cntA++;
    else cntB++;
    
    cout << cntA << ' ' << cntB << endl;
  }

  return 0;
}

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

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 array[100000000];
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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string s;
int a, b;

int main(){
	while (cin >> s&&s != "0"){
		a = 0, b = 0;
		FOR(i, 1, s.size()){
			if (s[i] == 'A') a++;
			else b++;
		}
		if (a > b) a++;
		else b++;
		cout << a << " " << b << endl;
		REP(i, 2){
			a = 0, b = 0;
			cin >> s;
			FOR(j, 1, s.size()){
				if (s[j] == 'A') a++;
				else b++;
			}
			if (a > b)a++;
			else b++;
			cout << a << " " << b << endl;
		}
	}
}

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