Tranform of input array of zeros and ones to array in which counts number of continuous ones:
[1, 1, 1, 0, 1] -> [3,1]
def ones_counter(input):
    c, result = 0, []
    for x in input + [0]:
        if x != 1 and c != 0:
            result.append(c)
            c = 0
        elif x == 1:
            c += 1
    return result
def ones_counter(input):
    c, result = 0, []
    for x in input + [0]:
        if x != 1 and c != 0:
            result.append(c)
            c = 0
        elif x == 1:
            c += 1
    return result