Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

HOLES Getting WA

$
0
0

include <stdio.h>

int main()
{
int t;
scanf("%d", &t);

fseek(stdin, 0, SEEK_END);

while (t--)
{
    char a[101];
    int i, numberOfHoles = 0;

    fgets(a, 100, stdin);

    for(i = 0; a[i] != '\0'; i++)
    {
        if(a[i] == 'A' || a[i] == 'D' || a[i] == 'O' || a[i] == 'P' || a[i] == 'Q' || a[i] == 'R')
        {
            numberOfHoles++;
        }
        else if(a[i] == 'B')
        {
            numberOfHoles += 2;
        }
    }

    printf("%d\n", numberOfHoles);
}

return 0;

}


Viewing all articles
Browse latest Browse all 40121

Trending Articles