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