#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
  string serve;
  int a_point;
  int b_point;
  int size_str;
  
  while(cin >> serve){

    if(serve=="0")break;

    a_point=0;
    b_point=0;
    size_str=serve.size();
    
    for(int i=1;i<size_str+1;i++){

      if(serve[i-1]==serve[i] && serve[i]=='A')
	a_point++;
      else if(serve[i-1]!=serve[i] && serve[i]=='A')
	a_point++;
      else if(serve[i-1]==serve[i] && serve[i]=='B')
	b_point++;
      else if(serve[i-1]!=serve[i] && serve[i]=='B')
	b_point++;

      // cout << a_point << " " << b_point << endl;
    }
    
    if(a_point>b_point)
      cout << a_point+1 << " " << b_point << endl;
    else if(a_point<b_point)
      cout << a_point << " " << b_point+1<< endl;
     

  }

  return 0;
}


  

