Your program is toreadfrom standard input. The input consists of T test cases. The numberof test cases T is given inthefirstlineofthe input. Each test case starts withaline containing astring composed by `O' and `X'andthelengthofthestring is more than 0and less than 80. There is no spaces between `O' and `X'.
Output
Your program is towriteto standard output. Print exactly onelineforeach test case. The line is to contain the score ofthe test case.
The following shows sample input and output forfive test cases.
Sample Input
5
OOXXOXXOOO
OOXXOOXXOO
OXOXOXOXOXOXOX
OOOOOOOOOO
OOOOXOOOOXOOOOX
Sample Output
10975530
#include<stdio.h>#include<string.h>#define N 85int main()
{
int num;
charstr[N];
scanf("%d", &num);
while(num--){
scanf("%s", str);
int len = strlen(str);
int i = 0, time = 0, sum =0;
for(; i<len; i++){
if(str[i] == 'O'){
time++;
sum += time;
} else {
time = 0; // 碰到X检测O的计数器变为0
}
}
printf("%d\n", sum);
}
return0;
}
Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. Each test case starts with a line containing a strin