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){
					isDuce = true;
				}
			}
			if(isDuce){
				if(latestDuce == 'A'){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}else{
				if(APoint[i] > BPoint[i]){
					APoint[i]++;
				}else{
					BPoint[i]++;
				}
			}
			isDuce = false;
			cout << APoint[i] << ' ' << BPoint[i] << '\n';
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main()
{
  string s;
  for(;cin>>s,s!="0";)
    {
      int data[3][2];
      memset(data,0,sizeof(data));
      //1st game
      for(int i=1;i<s.size();i++)
	data[0][s[i]-'A']++;
      //2nd game
     cin>>s;
      data[0][s[0]-'A']++;
      for(int i=1;i<s.size();i++)
	data[1][s[i]-'A']++;
      //3rd game
      cin>>s;
      data[1][s[0]-'A']++;
      for(int i=1;i<s.size();i++)
	data[2][s[i]-'A']++;
      if(data[2][0]>data[2][1])
	data[2][0]++;
      else
	data[2][1]++;

      for(int i=0;i<3;i++)
	cout<<data[i][0]<<" "<<data[i][1]<<endl;
    }
}

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

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

C++: #include<stdio.h>
#include<string.h>
int main(void)
{
	int 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\n",c,w);
	}	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int main(){
    string s[20];
    int count = 0;
    while(true){
        cin >> s[count];
        if(s[count] == "0")break;
        count++;
    }
    for(int i = 0; i < count; i++){
        string r = s[i];
        int a = 0, b = 0;
        for(int j = 1; j < r.size(); j++){
            if(r[j] == 'A')a++;
            else if(r[j] == 'B') b++;
 
        }
        if(a > b)a++;
        else b++;
        cout << a << " " << b << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
	string s[3];
	int A[3], B[3], i, j;
	bool f;
	while (1)
	{
		for (i = f = 0; i < 3; i++)
		{
			cin >> s[i];
			if (s[i] == "0")
			{
				f = true;
				break;
			}
		}
		if (f) break;

		for (i = 0; i < 3; i++)
		{
			A[i] = B[i] = 0;
			for (j = 1; j < s[i].length(); j++)
			{
				if (s[i][j] == 'A')
					A[i]++;
				else
					B[i]++;
			}
			if (i < 2 && s[i+1][0] == 'A')
				A[i]++;
			else
				B[i]++;
		}
		if (A[2] >= 10 && B[2] >= 10)
		{
			if (A[2] - B[2] == 1)
				A[2]++;
			else if (B[2] - A[2] == 1)
				B[2]++;
		}
		else if (A[2] == 10)
			A[2]++, B[2]--;
		else if (B[2] == 10)
			B[2]++, A[2]--;
		cout << A[0] << " " << B[0] << endl;
		cout << A[1] << " " << B[1] << endl;
		cout << A[2] << " " << B[2] << endl;
	}
	return 0;
}

C++: //28
#include<iostream>

using namespace std;

int main(){
  for(;;){
    for(int i=0;i<3;i++){
      char s[101];
      int scr[2]={};
      cin>>s;
      if(s[0]=='0')return 0;
      for(int j=1;s[j];j++){
	scr[s[j]-'A']++;
      }
      (*((scr[0]>scr[1])?scr:scr+1))++;
      cout<<scr[0]<<' '<<scr[1]<<endl;
    }
  }
  return 0;
}

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

int main(){

  string s;
  int n,m;

  while(true){
    cin >> s;
    if(s == "0") break;

    n = m = 0;

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

    if(n > m) cout << n+1 << " " << m << endl;
    else cout << n << " " << m+1 << endl;
  }
}

C++: // 2015/05/30 Tazoe

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

int main()
{
	while(true){
		char s[150];
		cin >> s;

		if(strcmp(s, "0")==0)
			break;

		int A = 0, B = 0;

		for(int i=1; i<strlen(s); i++){		// 最初のサーブは見ない
			if(s[i]=='A'){
				A++;
			}
			else{
				B++;
			}
		}

		if(A>B){		// 最後のポイントの処理
			A++;
		}
		else{
			B++;
		}

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

	return 0;
}

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

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		string s;
		cin>>s;
		if(s=="0") break;
		int a=0,b=0;
		rep(i,1,s.size()){
			if(s[i]=='A') a++;
			if(s[i]=='B') b++;
		}
		if(a<b) b++;
		else a++;
		o(a<<" "<<b);
	}
}

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

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

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

int main(){
  while(1){
    int point_a=0,point_b=0;
    string str;

    cin>>str;

    if(str[0]=='0')
      break;

    for(int i=1;i<str.size();i++){
      if(str[i]=='A')
        point_a++;
      else
        point_b++;
    }
    
    if(point_a>point_b)
      point_a++;
    else
      point_b++;
    
    cout<<point_a<<" "<<point_b<<endl;
  }

  return 0;
}

C++: #include <cstdio>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
    char game[101];
    int len;
    while(scanf("%s", game) && game[0] != '0') {
        len = int(strlen(game));
        map<char, int> m; m.insert({'A', 0}); m.insert({'B', 0});
        for (int i = 1; i < len; i++) {
            m[game[i]]++;
        }
        if (m['A'] > m['B']) m['A']++;
        else m['B']++;
        printf("%d %d\n", m['A'], m['B']);
    }
    return 0;
}

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

using namespace std;

int main(){

	while(1){
		string str;
		int serve=0;
		for(int i = 0; i < 3; i++){
			cin>>str;
			if(str=="0")
				return 0;
			int A=0;
			int B=0;
			for(int i = 1; i < str.size(); i++){
				if(str[i]=='A'){
					A++;
				}
				else
					B++;
			}
			if(A>B)
				A++;
			else
				B++;
			cout<<A<<" "<<B<<endl;
		}
	}

	return 0;
}