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