The length of the sequence

The length of the sequence. Given a sequence of non-negative integers where each number is written on a separate line, determine the length of the sequence. The sequence ends when an integer equal to 0 is encountered. Print the length of the sequence, excluding the integer 0. Numbers following the number 0 should be omitted.

Test Case Input (Sequence) Expected Output
1 1
2
3
0
4
5
3
2 4
0
1
2
1
3 7
3
5
0
3