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

int main(){
  string s[3];
  while(cin >> s[0], s[0] != "0"){
    cin >> s[1] >> s[2];
    for(int x=0;x<3;x++){
      int a=0, b=0;
      for(int i=1;i<(int)s[x].size();i++){
        if(s[x][i] == 'A')a++;
        else b++;
      }
      if(a>b)a++;
      else b++;
      cout << a << " " << b << endl;
    }
  }
}