#include <bits/stdc++.h>
using namespace std;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
int apoint[3],bpoint[3];
string data[3];
int main(void)
{
  while(cin >> data[0] && data[0]!="0")
    {
      memset(apoint,0,sizeof(apoint));
      memset(bpoint,0,sizeof(bpoint));
      data[0]+='C';
      cin >> data[1];
      data[1]+='C';
      cin >> data[2];
      data[2]+='C';
      for(int i=0;i<3;i++)
	{
	  for(int j=0;j<int(data[i].size()-1);j++)
	    {
	      if(data[i][j+1]!='C')
		{
		  if(data[i][j+1]=='A')
		    {
		      apoint[i]++;
		    }
		  else bpoint[i]++;
		}
	      else
		{
		  if(i!=2)
		    {
		      if(data[i+1][0]=='A') apoint[i]++;
		      else bpoint[i]++;
		    }
		  else
		    {
		      if((apoint[i]+1-bpoint[i])>=2) apoint[i]++;
		      else bpoint[i]++;
		    }
		}
	    }
	}
      for(int i=0;i<3;i++)
	{
	  cout << apoint[i] << ' ' << bpoint[i] << endl;
	}
    }
  return 0;
}

