UVA-1585 Score

#include<stdio.h>
int main()
{
    char a[100];
    int c,i,l,n,sum,j;
    scanf("%d",&n);
    for(j=0;j<n;j++)
    {
        int t;
        t=0,c=0;
        sum=0;
        scanf("%s",a);
        l=strlen(a);

        for(i=0;i<strlen(a);i++)
        {
            if(a[i]=='O')
            {
                c++;
                sum=sum+c;
            }
            if(a[i]=='X')
            {
                c=0;
            }
        }
                printf("%d\n",sum);
    }


    return 0;

}

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment