#include <iostream>
#include <string>
using namespace std;

int main(){
  while(1){
    int a=0,b=0;
    string game;
    cin >> game;
    if(game=="0")
      break;
    for(int j=1;j<game.size();j++)
      (game[j]=='A')?a++:b++;
    a>b?a++:b++;
    cout << a << " " << b << endl;
  }
  return 0;
}