Note : Make no assumptions about the data in the sequence.
For instance if there is no starting and ending 1 ( say the sequence is all 0), you have to output 0. 

Sample Inputs and Outputs

Sample input 1
--------------------
0 1 0 0 1 1 0 1 0 0 -1

Sample Output 1

----------------------

3  

Explanation

----------------

The sequence between first and last 1 is 1 0 0 1 1 0 1 and the sequence has 3 zeroes in between.

Sample input 2

--------------------
0 0 0 1 1 1 1 1 1 0 0 -1

Sample Output 2

----------------------

0  

Explanation

----------------

The sequence between first and last 1 is 1 1 1 1 1 1 and the sequence has 0 zeroes in between.

Sample input 3
--------------------
0 0 1 0 0 0 -1

Sample Output 1

----------------------



Explanation

----------------

The sequence has a single 1, therefore the output (by problem description) is 0.
Your last recorded submission was on 2024-02-08, 20:50 IST
Select the Language for this assignment. 
1
 #include<stdio.h>
2
int main()
3
{
4
   int bit, count=0,flag=0,sum=0;
5
   scanf("%d",&bit);
6
   while(bit!= -1)
7
   {
8
     if(bit==1)
9
     {
10
      flag=1;
11
      count+=sum;
12
      sum=0;
13
      scanf("%d",&bit);
14
     }
15
    if(flag)
16
      if(bit==0)
17
      sum++;
18
      scanf("%d",&bit);
19
   }
20
   printf("%d", count);
21
   return 0;
22
}
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   



InputOutput
Test Case 1
0 1 0 0 1 1 0 1 0 0 -1
3
Test Case 2
0 0 0 1 1 1 1 1 1 0 0 -1
0
Test Case 3
0 0 0 1 0 1 1 0 1 0 0 -1
2
Test Case 4
0 0 1 0 0 0 -1
0