반응형
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
for (int i = 0; i < n; i++) {
cin >> str;
int total = 0;
int score = 0;
for (auto a : str) {
if (a == 'X')
score = 0;
else
score++;
total += score;
}
cout << total << '\n';
}
}
O면 score누적점수를 위해 +1을 해주고
total에 더해주고
X면 누적이 안되여야하니 0으로 대입한다.
반응형