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

HOLES IN TEXT

$
0
0

this code runs well for given test case ....but gives runtime error.Please help

#include<stdio.h>
int main()
{
     char b[20];
     int i=0,c=0,t=0;
     scanf("%d",&t);
     while(t--)
     {
     c=0;
     i=0;
     scanf("%s",b);
     while (b[i]!='\0')
     {
     if (b[i]=='A'||b[i]=='D'||b[i]=='O'||b[i]=='P'||b[i]=='R')
     {
     c++;
     }
     else if(b[i]=='B')
     {
     c+=2;
     }
     i++;
     }
     printf("%d",c);
     }

     return 0;
}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



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