Created
May 3, 2019 15:54
-
-
Save godtaehee/7cc3c28eb7589016e52ee2222ae1028e to your computer and use it in GitHub Desktop.
#8958
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
int main(){ | |
int n; | |
int sum = 0; | |
char test[80]; | |
int cal[80]; | |
cin >> n; | |
for(int i = 0; i < n; i++){ | |
cin >> test; | |
int size = strlen(test); | |
for(int i = 0; i < size; i++) | |
cal[i] = 0; | |
for(int i = 0; i < size; i++) { | |
if (test[i] == 'O') | |
cal[i]++; | |
else | |
cal[i] = 0; | |
} | |
for(int i = 1; i < size; i++){ | |
if(cal[i]) | |
cal[i] = cal[i-1] + cal[i]; | |
} | |
for(int i = 0; i < size; i++) | |
sum += cal[i]; | |
cout << sum << endl; | |
sum = 0; | |
for(int i = 0; i < size; i++) | |
cal[i] = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment