0
Replace with sequence
Given a pattern (string or array format) of 1 and 0 :
[0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1]
The tasks is to replace consecutive 1 with an ascendant number sequence starting at 1.
Example: given [0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1] the output should be [0,1,2,3,0,1,2,0,0,0,1,2,3...