水题。
下面的是AC的代码:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char str[100];
int t;
while(cin >> t)
{
while(t--)
{
cin >> str;
int length = strlen(str);
int ans = 0, res = 0;
for(int i = 0; i < length; i++)
{
if(str[i] == 'O')
{
res++;
ans += res;
}
else
res = 0;
}
cout << ans << endl;
}
}
return 0;
}