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

int main(){
	int a,b,ss;
	string s;
	
	while(cin>>s){
		if(s[0]=='0')break;
		ss=s.size();
		if(ss>=22){
			
			if(s[s.size()-1]=='A'){
				cout<<ss/2+1<<" "<<ss/2-1<<endl;
			}else{
				cout<<ss/2-1<<" "<<ss/2+1<<endl;
			}
			
		}else{
			
			if(s[s.size()-1]=='A'){
				cout<<11<<" "<<ss-11<<endl;
			}else{
				cout<<ss-11<<" "<<11<<endl;
			}
			
		}
	}
	
	return 0;
}