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

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

		int a = s.size();
		int ap = 0, bp = 0;
		for (int i = 1;i < a;i++) {
			if (s[i] == 'A')ap++;
			else bp++;
		}
		if (ap < bp)bp++ ;
		else ap++;
		cout << ap << ' ' << bp << 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;
		bool serve = true;

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

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define MP make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main(){
    string s;
    while(cin>>s){
        if(s=="0")break;
        int a=0,b=0;
        rep(i,1,s.length()){
            if(s[i]=='A')a++;
            else b++;
        }
        (a>b)?a++:b++;
        cout<<a<<" "<<b<<endl;
    }

    
    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  while (cin >> s, s != "0") {
    int a = 0, b = 0;
    for (int i = 1; i < int(s.size()); i++) {
      if (s[i] == 'A') a++;
      else b++;
    }
    if (a > b) cout << a + 1 << " " << b << endl;
    else cout << a << " " << b + 1 << endl;
  }

  return 0;
}

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

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

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

int main(){
 
 string servepoint;

 int Apoint,Bpoint;

 while(1){

   cin >> servepoint;
 
   if(servepoint[0] == '0') break;

   int i;

   i = 1;
 
   Apoint = 0; Bpoint = 0;

   for(int i=1; i < servepoint.size();i++){

   if(servepoint[i] == 'A') Apoint++;
     
   else if(servepoint[i] == 'B') Bpoint++;
           
    
   }

  if(Apoint > Bpoint) Apoint++;
      
  else Bpoint++;

  cout << Apoint <<" "<< Bpoint <<endl;  

 }

 return 0;

}

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

int main()
{
	std::string s[3];
	while( std::cin >> s[0], s[0][0] - '0' )
	{
		for( int i = 1; i != 3; ++i )
			std::cin >> s[i];

		for( int i = 0; i != 3; ++i )
		{
			int pt[2] = { 0, 0 };
			
			for( int j = 1; j != s[i].size(); ++j )
				++pt[s[i][j]-'A'];

			if( i + 1 < 3 )
				++pt[s[i+1][0]-'A'];
			else
				++( pt[0] > pt[1] ? pt[0] : pt[1] );

			std::cout << pt[0] << ' ' << pt[1] << std::endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
	int h,box[2];
	char s[100];
	while(1){
		box[0]=0;
		box[1]=0;
		cin>>s;
		if(s[0]=='0')
			break;
		h=strlen(s);
		for(int i=0;i<h-1;i++)
		box[s[i+1]-'A']++;
		if(box[0]>box[1])
		box[0]++;
		else box[1]++;
		cout<<box[0]<<' '<<box[1]<<endl;
	}
	return 0;
}

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

int main(){
	while(true){
		char S[101];
		cin >> S;
		if(S[0]=='0')
			break;
		int countA=0;
		int countB=0;
		
		for(int i=1;S[i]!='\0';i++){
			if(S[i]=='A')
				countA++;
			else if(S[i]=='B')
				countB++;
		}
		if(countA > countB)
			countA++;
		else if(countA < countB)
			countB++;

		cout <<endl<< countA <<' '<< countB;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	string s;
	while (cin >> s, s != "0") {
		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 << endl;
	}
}

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

C++: #include <cstdio>
#include <cstring>

using namespace std;

int main()
{
	char score[101];
	int cnt_a = 0, cnt_b = 0;
	int len;
	
	while (1){
		scanf("%s", score);
		
		if (score[0] == '0'){
			break;
		}
		
		len = strlen(score);
		
		for (int i = 0; i < len; i++){
			if (score[i] == 'A'){
				cnt_a++;
			}
			else if (score[i] == 'B'){
				cnt_b++;
			}
		}
		
		if (cnt_a == 1){
			cnt_a--;
		}
		else if (cnt_b == 1){
			cnt_b--;
		}
		
		printf("%d %d\n", cnt_a, cnt_b);
	}
	
	return (0);
}

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

C++: //3ゲーム目の最後の得点をどちらがとったのかが分からない。
//↑は考察不足。ゲームが終了するには、リードしている方が点を取る必要があるので、最後はリードしている方が点を取った。
#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 ){
				if( cnt[ 0 ] > cnt[ 1 ] )
					cnt[0]++;
				else
					cnt[1]++;
			}
			if( i < 2 ){
				cnt[ s[i+1][0]-'A' ]++;
			}
			cout << cnt[0] << " " << cnt[1] << endl;
		}
	}
	return 0;
}