In this program, we will take a string as input and find the maximum length of consecutive 0’s in a given binary string.
Steps to solve the program
- Take a binary string as input.
- Split the binary string on 1 to find the maximum length of consecutive 0’s.
- Print the output.
#Input string
string ="10001100000111"
#splitting on 1
list1 = string.split("1")
max_ = (max(list1,key=len))
#Printing output
print(len(max_))
Output :
5