#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, i, j, k;
string s;
while(cin >> n)
{
for(k=1;k<=n;k++)
{
cin >> s;
int l = s.size(), j = 0;
long int sum = 0;
for(i=0;i<l;i++)
{
if(s[i] == 'O')
{
j++;
sum += j;
}
else if(s[i] == 'X')
j = 0;
}
cout << sum << endl;
}
}
return 0;
}
using namespace std;
int main()
{
int n, i, j, k;
string s;
while(cin >> n)
{
for(k=1;k<=n;k++)
{
cin >> s;
int l = s.size(), j = 0;
long int sum = 0;
for(i=0;i<l;i++)
{
if(s[i] == 'O')
{
j++;
sum += j;
}
else if(s[i] == 'X')
j = 0;
}
cout << sum << endl;
}
}
return 0;
}
Comments
Post a Comment