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

int main()
{
  string s;
  int i, c, score[2];
  while (cin>>s, s!="0") {
    score[0] = 0;
    score[1] = 0;
    c = s[0]-'A';
    for (i = 1; i < s.size(); i++) {
      if (c != s[i]-'A') c ^= 1;
      score[c]++;
    }
    if (score[0]<10) score[1]++;
    else if (score[1]<10) score[0]++;
    else if (score[0]<score[1]) score[1]++;
    else if (score[0]<score[1]) score[1]++;
    else score[0]++;
    cout<<score[0]<<" "<<score[1]<<endl;
  }
}