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

int main() {
	
	string a;
	int kazu,ten1,ten2;
	char sabu;
	int i;
	ten1=0;
	ten2=0;
	
	while(1){
		cin >> a;
		kazu=a.size();
		if(kazu==1) break;
		for(i=1;i<kazu+1;i++){
			sabu=a[i];
			if(sabu=='A') ten1++;
			if(sabu=='B') ten2++;
		}
		if(ten1<ten2) ten2++;
		if(ten1>ten2) ten1++;
		cout << ten1 << " " << ten2 << endl;
		ten1=0;
		ten2=0;
	}
	
	return 0;
}

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

int main(){
  while(1){
    int a=0,b=0;
    string game;
    cin >> game;
    if(game=="0")
      break;
    for(int j=1;j<game.size();j++)
      (game[j]=='A')?a++:b++;
    a>b?a++:b++;
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>
#include<cstdio>
#include<math.h>
using namespace std;
int main(){
    string str;
    int a=0,b=0;
    while(1){
        cin>>str;
        if(str=="0"){
            break;
        }
        for(int i=0+1;i<str.size()-1;i++){
            if(str[i]=='A'){
                a++;
            }
            else if(str[i]=='B'){
                b++;
            }
        }
        if(str[str.size()-1]=='A'){
            a+=2;
        }
        else if(str[str.size()-1]=='B'){
            b+=2;
        }
        cout<<a<<" "<<b<<endl;
        a=0;b=0;
    }
    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;;i++){
            if(ser[i]=='\0'&&a>b){
                a++;
                break;
            }
            else if(ser[i]=='\0'){
                b++;
                break;
            }
            if(i==21)i++;
            if(ser[i]=='A')a++;
            else b++;
            if((a==11||b==11)&&(a<10||b<10))break;
            else if((a-b==2||a-b==-2)&&(a>=10&&b>=10))break;
        }
        cout<<a<<" "<<b<<endl;
        a=0;b=0;
    }
}

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

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		string st; cin >> st;
		if (st == "0")break;
		int a = 0, b = 0;
		for (int i = 1; i < st.size(); ++i) {
			if (st[i] == 'A') {
				a++;
			}
			else {
				b++;
			}
		}
		if (a > b)a++;
		else b++;
		cout << a << " " << b << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  int as,bs;
  char s[101],sf,f;
  cin >> sf;
  while(cin>>s>>f){
    as = 0;
    bs = 0;
    for(int i=0;i<strlen(s);i++){
      if(s[i]=='A') as++;
      else bs++;
    }
    if(f=='0'){
      if(as>bs) as++;
      else bs++;
    } 
    else if(f=='A') as++;
    else bs++;
    cout << as << ' ' << bs << endl;
    if(f=='0') break;
  }
  return 0;
}

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

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

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

using namespace std;

int main (int argc, char *argv[]) {
    string str;
    while (cin>>str, str != "0") {
        int a = 0;
        int b = 0;
        str.erase(str.begin());
        for (char s : str) {
            if (s == 'A') a++;
            if (s == 'B') b++;
        }
        if (a > b) a++;
        else b++;
        cout << a << " " << b << endl;
    }
    return 0;
}

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

int main()
{
	while (1)
	{
		string s;
		cin >> s;
		if (s == "0")break;
		vector<int>ab(2);
		for (int c = 1; c < s.length(); c++) {
			if (s[c] == 'A')ab[0]++;
			else ab[1]++;
		}
		if (ab[0] == 10)cout << 11 << " " << ab[1] << endl;
		else cout << ab[0] << " " << 11 << endl;
	}
}

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

int main(){
  int a,b,i;
  string s;
  while(1){
    cin>>s;
    a=0,b=0;
    if(s[0]=='0')break;
    for(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++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (string s; cin >> s&&s != "0";) {
		int a = 0, b = 0;
		rep(i, 1, s.size()) {
			if (s[i] == 'A')a++;
			else b++;
		}
		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(std::cin >> s, s != "0"){
    int a = 0, b = 0;
    for (int i = 1; i < s.length(); i++) {
      if(s[i] == 'A')a++;
      else b++;
    }
    if(a - b >= 1)a++;
    else b++;
    std::cout << a << " " << b << std::endl;
  }
  return 0;
}

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

int main(){
while(1){
 string stra;
 cin>>stra;
 int pointA=0;
 int pointB=0;

 if(stra[0]=='0'){
	break;
 }
 for(int i=1;i<stra.size();i++){
	if(stra[i]=='A'){
		pointA++;
	}
	if(stra[i]=='B'){
		pointB++;
	}
 }
 if(pointA>pointB){
	pointA++;
 }
 else{
	pointB++;
 }
 cout<<pointA<<' '<<pointB<<'\n';
}
return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
char winer;
int main(){
	string s;
	while(cin >> s){
		if(s == "0") break;
		int scoreA=0, scoreB=0;

		for(string::size_type i=1; i<s.size(); i++){
			if(s[i] == 'A') scoreA++;
			if(s[i] == 'B') scoreB++;
		}
		if(scoreA > scoreB)
			cout << scoreA+1 << " " << scoreB << endl;
		else
			cout << scoreA << " " << scoreB+1 << endl;
	}
	return 0;
}