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 (true) {
        char serve[101] = {};
        cin >> serve;
        if (serve[0] == '0') {
            break;
        }
        int score[2] = {};
        for (int i = 1; serve[i] != '\0'; i++) {
            if (serve[i] == 'A') {
                score[0]++;
            } else {
                score[1]++;
            }
        }
        if (score[0] > score[1]) {
            score[0]++;
        } else {
            score[1]++;
        }
        cout << score[0] << " " << score[1] << endl;
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
string s;
main()
{
    while( 1 )
    {
        cin >> s;
        if( s == "0" ) break;
        int n = s.size();
        int a = 0, b = 0;
        for( int i = 0; i < n - 1; i++ )
        {
            if( s[i]  == 'A')
            {
                if( s[i + 1] == 'A' )a++;
                else b++;
            }
            else if( s[i] == 'B' )
            {
                if( s[i + 1] == 'A' )a++;
                else b++;
            }
        }
        if( a > b ) a++;
        else b++;
        printf( "%d %d\n", a, b );
    }
    return 0;
}

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

using namespace std;

int main(){

  while(1){
    string game;
    cin>>game;

    string zer("0");
    if(game == zer){
      break;
    }

    int c = 0;
    int a_p = 0;
    int b_p = 0;
    for(char e : game){
      if(c == 0){
        c = 1;
      }
      else{
        if(e == 'A'){
          ++a_p;
        }
        else{
          ++b_p;
        }
      }
    }

    if(a_p > b_p){
      ++a_p;
    }
    else{
      ++b_p;
    }

    cout<<a_p<<" "<<b_p<<endl;
  }

  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  bool serve = true;
  while(1){
    rep(i,3){
      int a = 0,b = 0;
      string s;
      cin >> s;
      if(s == "0") goto LABEL;
      REP(j,1,s.size()){
        if(s[j] == 'A'){
          ++a;
        }
        else{
          ++b;
        }
      }
      ((a < b)? b : a) += 1;
      cout << a << " " << b << endl;
    }
  }
LABEL:
  return 0;
}

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

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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

void mainmain(){
	string s;
	// int f=true;
	while(cin>>s,s[0]!='0'){
		int a=0,b=0;
		reep(i,1,s.size()){
			if(s[i]=='A'){
				a++;
			}
			else{
				b++;
			}
		}
		if(a>b) a++;
		else b++;
		cout<<a<<" "<<b<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

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

void f(const string& s,int& a, int& b){
	a = count( s.begin() , s.end() , 'A' );
	b = count( s.begin() , s.end() , 'B' );
}

int main(){
	string s;
	while( cin >> s , s != "0" ){
		int a,b;
		f(s,a,b);
		a--;
		(a>b)? a++ : b++ ;
		cout << a << " " << b << endl;
		for(int i=0 ; i < 2 ; i++ ){
			cin >> s;
			f(s,a,b);
			(s[0]=='A')? a-- : b-- ;
			(a>b)? a++ : b++ ;
			cout << a << " " << b << endl;
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main(){
	
	string str;
	
	int a, b;
	
	while(true){
		cin >> str;
		if(str.size() == 1){
			break;
		}
		a = 0;
		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++;
		}
		printf("%d %d\n", a, b);
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {

	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;
}