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 <stdio.h>

int main() {
  int i, j, a, b;
  char line[101];
  while (1) {
    for (i = 0; i < 3; ++i) {
      a = b = 0;
      scanf("%s", line);
      if (line[0] == '0') {
        return 0;
      }
      for (j = 1; line[j]; ++j) {
        if (line[j] == 'A') {
          ++a;
        } else if (line[j] == 'B') {
          ++b;
        }
      }
      if (a > b) {
        ++a;
      } else {
        ++b;
      }
      printf("%d %d\n", a, b);
    }
  }
}

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

int main(){
    int a, b, i;
    while(1){
        a=0; b=0;
        char s[101]={'\0'};
        cin >> s;
        if(s[0]=='0') break;
        for(i=1; s[i]!='\0' && s[i]!= '\n';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;
    }
    return 0;
}

C++: //3ゲーム目の最後の得点をどちらがとったのかが分からないので、このときは2点連続同じ人がとったと仮定する。
#include<iostream>
#include<string.h>
using namespace std;

char s[3][102];

int main(){
	int i,j;
	while( cin >> s[0] ){
		if( s[0][0] == '0' )
			break;
		cin >> s[1] >> s[2];
		
		for( i = 0;i < 3;i++ ){
			int cnt[2] = {0};
			for( j = 1;j < strlen( s[i] );j++ ){
				cnt[ s[i][j]-'A' ]++;
			}
			/*if( i == 2 ){
				cnt[ s[i][j-1]-'A' ]++;
			}*/
			if( i < 2 ){
				cnt[ s[i+1][0]-'A' ]++;
			}
			cout << cnt[0] << " " << cnt[1] << endl;
		}
	}
	return 0;
}

C++: #include<cstdio>
int main(){
  char c[105];
  int a,b;
  while(scanf("%s",c),c[0]!='0'){
    a=0;
    b=0;
    for(int i=1;c[i]!='\0';i++){
      if(c[i] == 'A') a++;
      if(c[i] == 'B') b++;
    }
    if(a > b) a++;
    if(b > a) b++;
    printf("%d %d\n",a,b);
  }
  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;i<str.size();i++){
            if(str[i]=='A'){
                a++;
            }
            else if(str[i]=='B'){
                b++;
            }
        }
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
  string serve;
  int a_point;
  int b_point;
  int size_str;
  
  while(cin >> serve){

    if(serve=="0")break;

    a_point=0;
    b_point=0;
    size_str=serve.size();
    
    for(int i=1;i<size_str+1;i++){

      if(serve[i-1]==serve[i] && serve[i]=='A')
	a_point++;
      else if(serve[i-1]!=serve[i] && serve[i]=='A')
	a_point++;
      else if(serve[i-1]==serve[i] && serve[i]=='B')
	b_point++;
      else if(serve[i-1]!=serve[i] && serve[i]=='B')
	b_point++;

      // cout << a_point << " " << b_point << endl;
    }
    
    if(a_point>b_point)
      cout << a_point+1 << " " << b_point << endl;
    else if(a_point<b_point)
      cout << a_point << " " << b_point+1<< endl;
     

  }

  return 0;
}

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

int main(){
  while(true){
    string result[3];
    for(int i = 0; i < 3; ++i){
      cin >> result[i];
      if(result[i]=="0")return 0;
    }
    for(int i = 0; i < 3; ++i){
      int a=0,b=0;
      for(int j = 1; j < result[i].length(); ++j){
	if(result[i][j]=='A')++a;
	else ++b;
      }
      //if(a>=10&&b>=10&&abs(b-a)<=1){
	if(b>a)++b;else ++a;
	//}
      cout << a << ' ' << b << endl;
    }
  }
  return 0;
}

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

int main(){
	string game;
	while(cin >> game, game[0] != '0'){
		int a = 0; int b = 0;

		for(int i=1; i < game.length(); i++){
			if(game[i] == 'A') a++;
			else b++;
		}
		if(a < b) cout << a << " " << b+1 << endl;
		else cout << a+1 << " " << b << endl;

	}
}

C++: #include<iostream>
using namespace std;
int main()
{
  string s;
  for(;cin>>s;)
    {
      if(s=="0")
	break;
      int p[2]={0};
      for(int i=1;i<s.size();i++)
	  p[s[i]-'A']++;
      bool c=true;
      for(int i=0;i<2;i++)
	  if(p[i]==11)
	    p[i]++,c=false;
      if(c)
	for(int i=0;i<2;i++)
	  if(p[i]==10)
	    p[i]++;
      cout<<p[0]<<" "<<p[1]<<endl;
    }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.bm", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if
		int i;
		int len = str.length();
		int scoreA = 0;
		int scoreB = 0;
		for (i = 1; i < len; ++i){
			if (str[i] == 'A'){
				++scoreA;
			}else{
				++scoreB;
			} // end if
		} // end for

		if (scoreA > scoreB ){
			++scoreA;
		}else if (scoreA < scoreB){
			++scoreB;
		} // end if

		cout << scoreA << ' ' << scoreB << endl;

	} // end loop

	return 0;
}

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

int main()
{
  while(true)
  {
    for (int i=0; i<3; i++)   //  dataset
    {
      string serves;
      getline(cin, serves);
      if ( serves[0] == '0' ) return 0;
      const char* str = serves.c_str();

      int score[2] = { 0, 0, };

      for (int i=1; str[i]; i++)    //  得点入力
      {
        switch(serves[i])
        {
          case 'A':
            score[0]++;
            break;
          case 'B':
            score[1]++;
            break;
        }
      }
      //  最後の一点
      if ( 10 <= score[0] && 10 <= score[1] )
      {
        if ( score[0] < score[1] )
        {
          score[1]++;
        }
        else
        {
          score[0]++;
        }
      }
      else if ( score[0] == 10 )
      {
        score[0]++;
      }
      else if ( score[1] == 10 )
      {
        score[1]++;
      }
      cout << score[0] << ' ' << score[1] << endl;
    }
  }
}

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

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

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

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

int main()
{
    string s = "";

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