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

Holes in the text

$
0
0

Unable to find the error in the program as it runs successfully and give desired result on linux terminal. But "WRONG ANSWER" is shown after submission. please help !

include<stdio.h>

include<string.h>

int main() { int holes=0,a,k,t,i; char arr[100]; scanf("%d",&t); if (t<=40) { for (i=0;i<t;i++) { scanf("%s",arr); a = strlen ( arr ); /////// a=a-1; for (k=0;k<=a;k++) { if (arr[k]=='B') holes = holes+2;

    else if ( arr[k]=='A' || arr[k]=='D' || arr[k]=='O' || arr[k]=='P' || arr[k]=='Q' || arr[k]=='R' )
    holes++;

    else continue;

}

printf("%d",holes);

} } return 0;

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>