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
		}
	}
}

Python: while True:
    s=input()
    if s=='0':
        break
    
    A=0
    B=0
    for i in range(1,len(s)):
        if s[i]=='A':
            A+=1
        else:
            B+=1
    if A==10 and B<10:
        A+=1
    elif B==10 and A<10:
        B+=1
    elif A>B:
        A+=1
    else:
        B+=1
    print(A, B)

Python: while True:
    n=input()
    if n=="0":
        break
    x=list(n)
    a=0
    b=0
    for i in range(len(x)-1):
        if x[i]=="A" and x[i+1]=="A":
            a+=1
        elif x[i]=="B" and x[i+1]=="A":
            a+=1
        elif x[i]=="B" and x[i+1]=="B":
            b+=1
        else:
            b+=1
    if a>=10 and b<10:
        a+=1
    elif b>=10 and a<10:
        b+=1
    elif a>=10 and b>=10:
        if x[len(x)-1]=="A":
            a+=1
        else:
            b+=1
    print(a,b)

Python: while True:
    n1=input()
    if n1=="0":
        break
    n2=input()
    n3=input()
    l1=len(n1)
    l2=len(n2)
    l3=len(n3)
    if n1=="0":
        break
    else:
        a1=n1.count("A",1)
        b1=n1.count("B",1)
        if n2[:1]=="A":
            a1+=1
        if n2[:1]=="B":
            b1+=1
        print(a1,b1)
        
        a2=n2.count("A",1)
        b2=n2.count("B",1)
        if n3[:1]=="A":
            a2+=1
        if n3[:1]=="B":
            b2+=1
        print(a2,b2)
        
        a3=n3.count("A",1)
        b3=n3.count("B",1)
        if a3>b3:
            a3+=1
        if a3<b3:
            b3+=1
        print(a3,b3)

Python: while True:
    x = input()
    if x== '0' :
        break
    m=0
    n=1
    a=0
    b=0
    if x[0]=='B':
        (n,m)=(m,n)
    for i in range(len(x)-1):
        if x[i] == x[i+1] :
            a += n
            b += m
        else :
            (n,m) = (m,n)
            a += n
            b += m
    if a>b : a+=1
    else : b+=1
    print(a,b)

Python: while 1:
    a=input()
    if a=='0':break
    d,e=a[1:].count('A'),a[1:].count('B')
    (b,c)=(0,1) if d<e else (1,0)
    print(d+b,e+c)

Python: while True:
    r = str(input())
    if r == '0':
        break
    r = r[1:]
    ten = [r.count('A'),r.count('B')]
    if ten[0] > ten[1]:
        ten[0] += 1
    else:
        ten [1] += 1
    print(ten[0],ten[1])

Python: while True:
    a = input()
    if a == '0':
        break
    b, c = a[1:].count('A'), a[1:].count('B')
    if b < c:
        d, e = 0, 1
    else:
        d, e = 1, 0
    print(b+d,c+e)

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

using namespace std;

int main(){
for(int x=0;x>=0;x++){
	char r[5];
	char a[5];
	char z[2]="0";
	cin>>r>>a;
	if((strcmp(r,z)==0)&&(strcmp(a,z)==0)){
		break;
	}
	int h=0,b=0;
	for(int i=0;i<=3;i++){
			for(int j=0;j<=3;j++){
				if(r[i]==a[j]){
					b++;
					if(i==j){
						h++;
					}
				}
			}
	}
	b=b-h;
	cout<<h<<' '<<b<<'\n';
}
	return 0;
}

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

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

int main(){
	strng s;
	while(cin>>s,s!="0"){
		int a,b;
		a=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<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&&ab[1]<10)cout << 11 << " " << ab[1] << endl;
		else if(ab[1]==10&&ab[0]<10) cout << ab[0] << " " << 11 << endl;
		else if (ab[0] > ab[1])cout << ab[0]+1 << " " << ab[1] << endl;
		else cout << ab[0] << " " << ab[1]+1 << endl;
	}
}

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

int main(){

  int len, cnt[2];
  string str;

  while(getline(cin, str)){
    len = str.length();
    if(len == 1) break;
    fill(cnt, cnt+2, 0);

    for(int i=1; i<len; i++){
      if(str[i] == 'A') cnt[0]++;
      else cnt[1]++;
    }
    if(cnt[0] < cnt[1]) cnt[1]++;
    else cnt[0]++;
 
    cout << cnt[0] << " " << cnt[1] << endl;

  }

  return 0;

}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

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

int main(void){
  string line[3];
  while(cin>>line[0]>>line[1]>>line[2]){
    REP(i,3){
      int a=0,b=0;
      FOR(j,1,line[i].size()){
        if(line[i][j]=='A') a++;
        else b++;
      }
      if(a-b>0) a++;
      else b++;
      cout<<a<<" "<<b<<endl;
    }
  }
  return 0;
}

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

int main(){


  int serve = 0;
    
  int sa=0,sb=0;


  while(1){
    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++,serve = 0;
      else if(s[i] == 'B')  b++,serve = 1;
    }
    if( a > b ) a++,sa++;
    if( b > a ) b++,sb++;
    
    cout << a << " " << b << "\n";
  }
    
  
}

C++: #include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int i,j,counta=0,countb=0,bx;
    string str;
bool bo=false;
void duce();
int main(){
    for(i=1;;i++){
            getline(cin,str);
        if(str[0]=='0'){
            break;
        }
            for(j=1;j<str.size();j++){
            if(counta==10 && countb==10){
                duce();
                bo=true;
                break;
            }
            else if(str[j]=='A'){
                counta++;
            }
            else if(str[j]=='B'){
                countb++;
            }
        }
        if(bo){
            bo=false;
        }
        else if(counta<countb){
            countb++;
        }
        else if(counta>countb){
            counta++;
        }
        cout<<counta<<" "<<countb<<endl;
        counta=0;
        countb=0;
    }
    return 0;
}
void duce(){
    counta=0;countb=0;
        for(;j<str.size();j++){
            if(str[j]=='A'){
                counta++;
            }
            else{
                countb++;
            }
        }
        if(counta<countb){
            counta=10;countb=12;
        }
        else{
            counta=12;countb=10;
        }
    
    return;
}