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 <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


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

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

C++: #include<iostream>
using namespace std;
string str,str2,str3;
int a,b;
int main(){
  while(1){
    cin>>str;
    if(str=="0")break;
    cin>>str2>>str3;

    a=b=0;
    for(int i=1;i<(int)str.size();i++){
      if(str[i]=='A')a++;
      else b++;
    }
    if(str2[0]=='A')a++;
    else b++;
    cout<<a<<' '<<b<<endl;
    


    a=b=0;
    for(int i=1;i<(int)str2.size();i++){
      if(str2[i]=='A')a++;
      else b++;
    }
    if(str3[0]=='A')a++;
    else b++;
    cout<<a<<' '<<b<<endl;


    a=b=0;
    for(int i=1;i<(int)str3.size();i++){
      if(str3[i]=='A')a++;
      else b++;
    }

    if(a>b)a++;
    else b++;
    
    cout<<a<<' '<<b<<endl;


  }
  return 0;
}

C++: // 2011/02/17 Tazoe

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

int main()
{
	while(true){
		string gam;
		cin >> gam;
		if(gam=="0")
			break;

		int A = 0;
		int B = 0;
		for(int i=1; i<gam.size(); i++)
			if(gam[i]=='A')
				A++;
			else
				B++;

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

		cout << A << ' ' << B << endl;
	}

	return 0;
}

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

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

using namespace std;

int main() {
  
  string game;
  while(1) {
    bool flag = 0;
    
    for(int I=0; I<3; I++) {
      
      cin >> game;
      if(game == "0") { flag = 1; break; }
    
      int cntA = 0, cntB = 0;
      
      game = game.substr(1);
      
      int const N = game.size();
      for(int i=0; i<N; i++) {
	cntA += game[i] == 'A';
	cntB += game[i] == 'B';
      }
      
      if(cntA > cntB) {
	if(cntA >= 11) {
	  cntA = cntB + 2;
	}
	else {
	  cntA = 11;
	}
      }
      else {
	if(cntB >= 11) {
	  cntB = cntA + 2;
	}
	else {
	  cntB = 11;
	}
      }
    
      cout << cntA << ' ' << cntB << endl;
      
    }
    
    if(flag) break;
  }
  
  return 0;
}

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

C++: int main(){char s[111];while(scanf("%s",s),s[0]!='0'){int a=0,b=0,i;for(i=1;s[i];)s[i++]-66?a++:b++;printf("%d %d\n",a+(a>b),b+(b>a));}return 0;}

C++: // Tazoe

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

int main()
{
	while(true){
		string srv;
		cin >> srv;

		if(srv=="0")
			break;

		int ptA = 0;
		int ptB = 0;
		for(int i=1; i<srv.size(); i++){
			if(srv[i]=='A'){
				ptA++;
			}
			else{
				ptB++;
			}
		}

		if(ptA>ptB){
			ptA++;
		}
		else{
			ptB++;
		}

		cout << ptA << ' ' << ptB << '\n';
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
    char ser[102];
    int a=0,b=0;
    while(1){
        scanf("%s",ser);
        if(ser[0]=='0')break;
        for(int i=1;ser[i]!='\0';i++){
            if(ser[i]=='A')a++;
            else b++;
        }
        if(a>b)a++;
        else b++;
        cout<<a<<" "<<b<<endl;
        a=0;b=0;
    }
}

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

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	string s;
	while(cin >> s)
	{
		if(s == "0") break;

		int pa = 0,pb = 0;

		REP(i,1,s.size())
		{
			if(s[i] == 'A') pa++;
			if(s[i] == 'B') pb++;
		}

		if(pa > pb) pa++;
		else pb++;

		cout << pa << " " << pb << endl;
	}
	return 0;
}

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

int main(){
	string s;
	int a,b;
	while(getline(cin,s)){
		if(s == "0") break;
		a = b = 0;
		for(int i = 1;i <= s.length();++i){
			if(s[i] == 'A') ++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 = count(s.begin()+1,s.end(),'A');
    int b = count(s.begin()+1,s.end(),'B');
    if(a>b) a++;
    else b++;
    cout << a << ' ' << b << endl;
  }
  return 0;
}

C++: // AOJ 0174
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string str;
	while (1){
		cin >> str;
		if (str == "0") break;
		int kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		cin >> str;
		if (str[0] == 'A'){
			kotori++;
		}
		else hanayo++;
		cout << kotori << " " << hanayo << endl;

		kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		cin >> str;
		if (str[0] == 'A'){
			kotori++;
		}
		else hanayo++;
		cout << kotori << " " << hanayo << endl;

		kotori = 0, hanayo = 0;
		for (int i = 1; i < str.length(); i++){
			if (str[i] == 'A'){
				kotori++;
			}
			else hanayo++;
		}
		if (kotori < hanayo) hanayo++;
		else kotori++;
		cout << kotori << " " << hanayo << endl;
	}

	return 0;
}