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