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 <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	string str;
	while (cin >> str, str != "0") {
		int a = count(str.c_str() + 1, str.c_str() + str.size(), 'A');
		int b = count(str.c_str() + 1, str.c_str() + str.size(), 'B');
		if (a >= 10 && b >= 10) {
			if (a > b) a++;
			else b++;
		}
		else if (a == 10) a++;
		else if (b == 10) b++;
		
		cout << a << " " << b << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int main(){

  int a=0, b=0;
  char in;
  int i = 0;

  while(scanf("%c",&in)){
    if(in == '0') break;
    if(i == 0){
      scanf("%c",&in);
      i++;
    }
    if(in == 'A') a++;
    if(in == 'B') b++;
    if(in == '\n'){
      i = 0;
      if(a > b) a++;
      else b++;
      cout << a << " " << b << endl;
      a = 0;
      b = 0;
    }

  }
  return 0;

}

C++: #include <iostream>
using namespace std;
int main(){string a[3];while(cin>>a[0]){if(a=="0")break;int p[2]={};cin>>a[1]>>a[2];for(int i=0;i<a[0].size();i++)p[a[0][i]=='B']++;for(int i=1;i<a[1].size();i++)p[a[1][i]=='B']++;for(int i=1;i<a[2].size();i++)p[a[2][i]]++;cout<<p[0]<<" "<<p[1]<<endl;}}

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

int main()
{
	string s;
	int a, b;

	cin >> s;

	while (s != "0") {
		a = 0;
		b = 0;

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

		cout << a << " " << b << endl;
		cin >> s;
	}

	return 0;
}

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

int main() {
    string data;

    while (cin >> data) {
        if (data == "0") break;
        int score[2] = {0};
        for (int i = 1, l = data.size(); i < l; i++) {
            score[data[i] == 'B']++;
        }
        score[score[0]<score[1]]++;
        cout << score[0] << " " << score[1] << endl;
    }
    return 0;
}

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

using namespace std;

void solve()
{
	string str;
	while(cin >> str, str != "0")
	{
		int pointA = 0;
		int pointB = 0;
		for(int i = 1; i < str.size(); ++i)
		{
			if(str[i] == 'A')
			{
				++pointA;
			}
			else
			{
				++pointB;
			}
		}
		if(pointA > pointB)
		{
			++pointA;
		}
		else
		{
			++pointB;
		}
		cout << pointA << " " << pointB << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3];
	char sabu[102];
	while(1) {
		f=cnt=0;
		for(i=0;i<3;i++) {
			cin>>sabu;
			a=b=0;
			if(sabu[0]=='0') {
				cnt=1;
				break;
			}
			for(j=1;j<strlen(sabu);j++) {
				if(sabu[j]=='A') a++;
				else b++;  
				if(a==b&&a>10) a=b=10;
			}
			if(a>b)s1[i]=a+1,s2[i]=b;
			else s1[i]=a,s2[i]=b+1;
		}
		if(cnt==1) break;
		for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl;
		
	}
	return 0;
}

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

int main(void){
	string s;
	int a[2];
	for(;;){
		cin >> s;
		if(s[0] == '0')break;
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		cin >> s;
		++a[s[0] - 'A'];
		printf("%d %d\n", a[0], a[1]);
		
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		cin >> s;
		++a[s[0] - 'A'];
		printf("%d %d\n", a[0], a[1]);
		a[0] = 0; a[1] = 0;
		for(int i = 1;i < s.size();++i)++a[s[i] - 'A'];
		if(a[0] == 10 && a[1] < 10)++a[0];
		if(a[1] == 10 && a[0] < 10)++a[1];
		if(a[0] >= 10 && a[1] >= 10)++a[a[0] < a[1]];
		printf("%d %d\n", a[0], a[1]);
	}
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  int as,bs;
  char s[1000],f;
  cin >> f;
  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;
  }
  return 0;
}

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

int main() {
	string moji;
	int i,acnt,bcnt;
	while(1){
		cin>>moji;
		i=acnt=bcnt=0;
		if(moji[i]=='0') break;
		i++;
		while(moji[i]=='A' || moji[i]=='B'){
			if(moji[i]=='A') acnt++;
			if(moji[i]=='B')bcnt++;
			i++;
		}
		if(acnt>bcnt)acnt++;
		else bcnt++;
		cout<<acnt<<" "<<bcnt<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;



int main(){

	int A_P,B_P;
	char buf[110];

	while(true){
		scanf("%s",buf);
		if(buf[0] == '0')break;

		A_P = B_P = 0;

		for(int i= 1;buf[i] != '\0'; i++){
			if(buf[i] == 'A'){
				A_P++;
				if(buf[i+1] == '\0'){
					if(A_P > B_P)A_P++;
					else{
						B_P++;
					}
				}
			}
			else{
				B_P++;
				if(buf[i+1] == '\0'){
					if(A_P > B_P)A_P++;
					else{
						B_P++;
					}
				}
			}
		}
		printf("%d %d\n",A_P,B_P);
	}
    return 0;
}

C++: #include <iostream>

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

using namespace std;
typedef pair<string, int> P;
/** Problem0174 : Badminton **/
int main()
{
	int a, b;
	string s;
	while (cin>>s, s!="0") {
		a=0; b=0;
		s[0]='#';
		rep(i, s.length()) {
			if (s[i] == 'A') a++;
			else if (s[i] == 'B') b++;
		}
		if (a>b) a++;
		else b++;
		
		cout << a << " " << b << endl;
	}
	return 0;
}

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

C++: // 2014/06/20 Tazoe

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

int main()
{
	while(true){
		string s;
		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>B){
			A++;
		}
		else{
			B++;
		}

		cout << A << ' ' << B << '\n';
	}

	return 0;
}

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

int main(){
	
	while(true){
		char s[29];
		cin >> s;
		
		if(s[0] == '0') break;
		
		int a=0,b=0;
		
		int len = strlen(s);
		
		for(int i = 1;i < len;i++){
			if(s[i] == 'A'){
			a++;
			}else if(s[i] == 'B'){
			b++;
			}
		}
		if(a >= 10 && b >= 10){
			if(a > b){
			cout << a + 1 << " " << b << endl;
			}else{
			cout << a << " " << b + 1 << endl;
			}
	
		}else if(a == 10){
		cout << 11 << " " << b << endl;
		}else if(b == 10){
		cout << a << " " << 11 << endl;
		}
	}
	
	return 0;
	
}

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    int n; string s;
    for (int h = 0; h < 20; h++) {
        cin >> s; int a = 0, b = 0;
        if (s == "0") { return 0; }
        for (int h = 1; h < s.size(); h++) {
            if (s[h] == 'A') { a++; }
            if (s[h] == 'B') { b++; }
        }
        if (a > b) { cout << a + 1 << ' ' << b << endl; }
        else {
            cout << a << ' ' << b + 1 << endl;
        }
    }
}