#include <iostream>
using namespace std;
int main()
{
int t;
string result;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> result;
int count = 0; // for문 안에서 count, sum 초기화
int sum = 0;
for (int j = 0; j < result.length(); j++)
{
if (result[j] == 'O')
count++;
else
count = 0;
sum += count;
}
cout << sum << endl;
}
return 0;
}
'코딩 공부 > C++' 카테고리의 다른 글
백준 10871번: X보다 작은 수 [C++] (1) | 2024.08.26 |
---|---|
백준 10807번: 개수 세기 [C++] (1) | 2024.08.25 |
c++ 6주차 (0) | 2022.12.17 |
[C++] 10807번 (0) | 2022.12.17 |
C++ Chapter 7. 배열 (0) | 2022.12.13 |