Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- char arr[105],ch;
- int t,j,i,zero,f,l,sz;
- scanf("%d",&t);
- for(j=0;j<t;j++)
- {
- scanf("%s",&arr);
- i=0;
- zero=0;
- while((ch=arr[i])!='\0')
- {
- if(ch=='0')
- zero++;
- i++;
- }
- i=0;
- f=0;
- while((ch=arr[i])!='1')
- {
- if(ch=='0')
- f++;
- i++;
- }
- sz=strlen(arr);
- i=sz-1;
- l=0;
- while((ch=arr[i])!='1')
- {
- if(ch=='0')
- f++;
- i--;
- }
- printf("%d\n",zero-f-l);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement