#include <stdio.h>
#include <stdlib.h>
#define maxn 80
int main(){
char str[maxn];
int T, sorce, countA;
scanf("%d", &T);
while(T--){
scanf("%s", str);
sorce = 0;countA = 0;
for(int i=0;i<str[i];i++){
if (str[i] == 'X') countA = 0;
else {countA++; sorce += countA;}
}
printf("%d\n", sorce);
}
}