#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main()
{ int n;
cin>>n;
string score;
while(n--)
{ int dynic=0,sum=0;
cin>>score;
for(int i=0;i<score.length();i++)
{
if(score[i]=='O')dynic++;//OOOOOXXXXXOOOOOXXXXX
else if(score[i]=='X')dynic=0;
sum=sum+dynic;
}
cout<<sum<<endl;
}
return 0;
}