题解:
按照题意做就行了,难道不大,每次记录好有木有连续就ok
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
int main() {
//freopen("in.txt","r",stdin);
//freopen("output.txt","w",stdout);
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++){
string str;
cin >> str;
int sum = 0;
int lnk = 1;
int len = str.size();
for(int j = 0; j < len; j++){
if(str[j]=='O'){
sum += lnk;
lnk++;
}else lnk = 1;
}
printf("%d\n",sum);
}
return 0;
}