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

int main(){

  int len, cnt[2];
  string str;

  while(getline(cin, str)){
    len = str.length();
    if(len == 1) break;
    fill(cnt, cnt+2, 0);

    for(int i=1; i<len; i++){
      if(str[i] == 'A') cnt[0]++;
      else cnt[1]++;
    }
    
    cout << cnt[0] << " " << cnt[1] << endl;
  }

  return 0;

}