링크 : https://www.acmicpc.net/problem/8958
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
int n = 0;
cin >> n;
for(int i = 0; i < n; i++){
string s;
cin >> s;
int cnt = 0;
int sum = 0;
if(s[0] == 'O'){
cnt = 1;
sum = 1;
}
for(int j = 1; j < s.size(); j++){
if((s[j] == s[j-1] && s[j] == 'O') || s[j] == 'O'){
cnt ++;
sum += cnt;
}
else cnt = 0;
}
cout << sum << endl;
}
return 0;
}