Ad Code

Responsive Advertisement

1585 - Score

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function#include<stdio.h>

#include<string.h>

int main(){

    int i, o, sum, t, len;

    char ch[82];

    scanf("%d", &t);

    while(t--){

        o = sum =0;

        scanf("%s", ch);

        len=strlen(ch);

        for(i=0; i<len; i++){

            if(ch[i]=='O'){

                o++;

                sum+=o;

            }else{

                o=0;

            }

        }

        printf("%d\n", sum);

    }

    return 0;

}




Post a Comment

0 Comments