import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i < N; i++)
{
int count = 0;
String text = br.readLine();
char[] text2 = text.toCharArray();
int total = 0;
for (char c : text2) {
if (c == 'O')
{
count++;
total += count;
}
else if (c == 'X')
{
count = 0;
}
}
System.out.println(total);
}
}
}
연속된 O의 개수만큼 값이 커지는 상황이여서 count말고도 total이라는 변수를 생성하여야 했고 X가 나오면 count를 초기화시켜야 했다. 처음엔 생각하지 못했다가 total이라는 변수를 생각하고서 문제를 풀게되었다.