using System;
class Program
{
static void Main(string[] args)
{
string stringNumber = Console.ReadLine();
int intNumber = System.Convert.ToInt32(stringNumber);
int[] resultArray = new int[intNumber];
for (int i = 0; i < intNumber; i++)
{
string stringOX = Console.ReadLine();
char[] array = stringOX.ToCharArray();
int score = 0;
int total = 0;
for (int j = 0; j < array.Length; j++)
{
if (array[j] == 'O')
{
score++;
}
else if (array[j] == 'X')
{
score = 0;
}
total += score;
}
resultArray[i] = total;
}
for (int i = 0; i < resultArray.Length; i++)
{
Console.WriteLine(resultArray[i]);
}
}
}