Input
Your program is to read from standard input. The input consists of T test cases.
The number of testcases T is given in the first line of the input.
Each test case starts with a line containing a stringcomposed by ‘O’ and ‘X’ and the length of the string is more than 0 and less than 80.
There is no spacesbetween ‘O’ and ‘X’.OutputYour program is to write to standard
output.
Print exactly one line for each test case. The line is tocontain the score of the test case
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n;
int count,sum,i;
char score[100];//数组开大一点
cin>>n;
getchar();
while(n--)
{
sum=0;
count=0;
cin>>score; //不用(score[i]=getchar())!='\n';
for(i=0;score[i]!='\0';i++)
{
if(score[i]=='X')
{
count=0;
}
else if(score[i]=='O')
{
count++;
}
sum=sum+count;
}
cout<<sum<<endl;
memset(score,'\0',100);
}
return 0;
}