# Task
 You are given a binary string (a string consisting of only '1' and '0'). The only operation that can be performed on it is a Flip operation. 
 
 It flips any binary character ( '0' to '1' and vice versa) and all characters to the `right` of it.

 For example, applying the Flip operation to the 4th character of string "1001010" produces the "1000101" string, since all characters from the 4th to the 7th are flipped.

 Your task is to find the minimum number of flips required to convert the binary string to string consisting of all '0'.

# Example

 For `s = "0101"`, the output should be `3`.

 It's possible to convert the string in three steps:

 ```
 "0101" -> "0010"
    ^^^
 "0010" -> "0001"
     ^^
 "0001" -> "0000"
      ^
 ```

# Input/Output


 - `[input]` string `s`

  A binary string.

 
 - `[output]` an integer

  The minimum number of flips required.

Difficulty: introductory

Starter code:

def bin_str(s):
	

Solutions:
def bin_str(s):
    return s.count("10") * 2 + (s[-1] == "1")

def bin_str(input):
    flips_needed = 0
    last_seen = '0'
    for c in input:
        if last_seen != c:
            flips_needed += 1
            last_seen = c
    return flips_needed

import re

def bin_str(s):
    return len(re.findall("(?:1+)|(?:0+)", s.lstrip("0")))

import re
def bin_str(s):
    return len(re.findall(r'0+|1+', s.lstrip('0')))

import re

def bin_str(s):
    return len(re.findall(r'(1+)|((?<=1)0+)', s))

bin_str=lambda n:sum(a!=b for a,b in zip('0'+n,n))

def bin_str(s):
    return s.count("10")*2+int(s[-1])

def bin_str(s):
    c = 0
    x = '0'
    for i in s:
        if x != i:
                c += 1
                x = i
    return c


def bin_str(s):    
    
    count = 0
    
    while s.count("1") != 0:
    
        first_index = s.index("1")      
        
        n = ""    
        
        
        
        for nbr in s[first_index:len(s)]:

            if nbr == "1":
        
                n += "0"

            elif nbr == "0":
        
                n += "1"
        
        s = s[0:first_index] + n

        count +=1
             
             
    return count