#include <stdio.h>
#include <string.h>

int main() {
    int n;
    int total,score;
    char ox[81]={0};
    scanf("%d",&n);
    while(n--) {
        total=0;
        scanf("%s",ox);
        score=0;
        for  (int i=0; i<strlen(ox);i++) {
            if(ox[i]=='O') {
                score+=1;
                total+=score;
            }
            else {
                score=0;
            }
        }
        printf("%d\n",total);
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: