Count Longest Continuous 0 and 1 in a Binary String
Given a binary string contains 0’s and 1’s. Write a program to find the longest contiguous occurrence of 0’s and 1’s.
For example:
Input string — 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 1 0 0 0 1
Length_0: 3 Length_1: 3
Input string — 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 0 1 0 1 0
Length_0: 5 Length_1: 3