Beautiful Binary String

  • + 0 comments

    python3

    def beautifulBinaryString(b):
        # Write your code here
    
        count = 0   
        while b.find('010') != -1:
           b = b.replace('010', '011', 1)
           count +=1
        
        return count