include iostream
include cstring
using namespace std;
int main(){
int t;
char a[80];
int score;
int count;
cin>>t;
for(int i=0;i<t;i++){
cin>>a;
count=0;
score=0;
for(int j=0;j<int(strlen(a));j++){
if(a[j]=='O')count++;
else if(a[j]=='X')count=0;
else if(a[j]=='\0')break;
score+=count;
}
cout<<score<<endl;
}
return 0;
}