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