백준 8958

hyun20·2021년 7월 3일
#include <iostream>
#include <string>
using namespace std;
int main() {
	int testN,result, connected;
	string s;
	cin >> testN;
	for (int i = 0; i < testN; i++) {
		connected = 0; result = 0;
		cin >> s;
		for (int i = 0; i < s.length(); i++) {
			if (s[i] == 'O')
				connected++;
			else connected = 0;
			result += connected;
		}
		cout << result << '\n';
	}
}

0개의 댓글