#include <stdio.h>
#include <string.h>
int main()
{
int T;
char s[85];
scanf("%d",&T);
while(T--) {
scanf("%s",s);
int n = strlen(s),score = 0,subscore = 1;
if(n < 1 || n > 80)
return -1;
for(int i = 0; i < n; i++) {
if( s[i] == 'X' )
{
subscore = 1;
continue;
}
score += subscore;
if(s[i+1] == 'O' )
subscore++;
}
printf("%d\n",score);
}
return 0;
}