Valid Substrings in Binary String

Company: IBM_28thjuly_2

Difficulty: medium