My issue
this code is running successfully , but while submitting it gives Runtime Error
pls verify my code
My code
#include <stdio.h>
int main(void) {
int T,i,j,ctr=0,arr[50];
char str[50];
scanf("%d",&T);
for(i=0;i<T;i++){
scanf("%s", str);
j=0;
ctr=0;
while(str[j]!='\0'){
if((str[j]=='1') && str[j+1]!='1'){
ctr++;
}
j++;
}
arr[i]=ctr;
}
for(i=0;i<T;i++) {
printf("%d",arr[i]);
printf("\n");
}
}
Problem Link: Chef and Groups Practice Coding Problem - CodeChef