[Question]
  [
Given a pattern (string or array format) of Bits :
`[0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1]` 
The tasks is to replace any number of consecutive 1-Bits with an ascending number sequence starting at 1.
**Input**
* Pattern (can be received as an string or array) Example:
	+ String: `1001011010110101001`
	+ Array: `[1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1]`
**Output**
* Ascending number sequence (can be returned as an string or array) Example:
	+ String: `1 0 0 1 0 1 2 0 1 0 1 2 0 1 0 1 0 0 1`
	+ Array: `[1, 0, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 0, 0, 1]`
**Rules**
* *(only apply for strings)* Input wont contain spaces between `1` and `0`
* Assume Input `length > 0`
* *(only apply for strings)* Output is separated by space (use any other separator if you need as long as is not a number or a letter from the alphabet)
**Example:** 
```
Given [0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1] 
Output [0,1,2,3,0,1,2,0,0,0,1,2,3,4,5,6]
--------------------------------------------------------------------------
Given 0110101111101011011111101011111111     
Output 0 1 2 0 1 0 1 2 3 4 5 0 1 0 1 2 0 1 2 3 4 5 6 0 1 0 1 2 3 4 5 6 7 8
---------------------------------------------------------------------------
Given 11111111111101    
Output 1 2 3 4 5 6 7 8 9 10 11 12 0 1
```
---
Winning criteria: Codegolf
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
γ€ƶ˜
```
[Try it online!](https://tio.run/##MzBNTDJM/f//3OZHTWuObTs95///aAMdQzA0gJIGOjARMIwFAA "05AB1E – Try It Online")
or as a [Test Suit](https://tio.run/##MzBNTDJM/V9TVhn8/9zmR01rjm07Ped/pdLh/Qq6dgqH9yvp/DcwNDQEYgMDEAMIuEAcQwgHTEPFYWIgJYZIwMAQAA)
**Explanation**
```
γ      # split input into groups of consecutive equal elements
 €ƶ    # multiply each number in each sublist by its 1-based index in the sublist
   ˜   # flatten
```
[Answer]
# [Haskell](https://www.haskell.org/), 15 bytes
```
scanl1$(*).succ
```
[Try it online!](https://tio.run/##bVHLboMwELzzFaMoB6g2CEiTtlLopVJvPfdAOFhgEquOQba59ONLlygv2mgl27s7M16P98J9Sa2HBjm2g6uE0ek8fIhi11fVoEzXe4c8AAoUKd2PhNKSEYQiOeeUTPt07dyr38RE6cpLpsgRVQaBla7XtwNmtKRHWtGanuiZXihlFsOzPzNml7vPhGt@W13/wx2FJ0rLCy@ZIk8zHoQybG7dcqoaCFNjjm/VfSq/R7hVsFi8ooFCnsNGOHl@fprfS8NMcMH31iCMOJPayWNRWttazN6F0rKGl867OJ4F3DuI7gNhZ5XxiFk@ZgFRR7xrZSRbttlgJ/1ba7w03g1FGRRsUZGM@2gWr@P59AHlT9VosXPDouq6Xw "Haskell – Try It Online")
### Explanation/Ungolfed
`scanl1` iterates from left over a list using a function which takes the last result and the current element generating a new list with the results, leaving empty lists and singletons "unmodified".
`(*).succ` is the equivalent of `\x y-> (x+1)*y`
Using that function together with `scanl1` only works because the increasing sequences (*1,2,3,..*) start with *1* and either have no preceding element (in which case it's the first element in the list which won't be "modified") or they have a leading *0*.
[Answer]
# [Python 2](https://docs.python.org/2/), 36 bytes
```
c=0
for i in input():c=c*i+i;print c
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9nWgCstv0ghUyEzD4gKSks0NK2SbZO1MrUzrQuKMvNKFJL//4820DEEQwMoaaADEwHDWAA "Python 2 – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~5 4~~ 3 bytes
```
ṁ∫g
```
[Try it online!](https://tio.run/##yygtzv7//@HOxkcdq9P///8fbaBjCIYGUNJAByYChrEA "Husk – Try It Online")
### Explanation
```
ṁ∫g  -- full function, example input: [1,1,1,0,1]
  g  -- group: [[1,1],[0],[1]]
ṁ    -- map the following and concatenate result (example with [1,1,1])
 ∫   -- | cumulative sum: [1,2,3]
     -- : [1,2,3,0,1]
```
**Edit history**
-1 byte by using `scanl1` over `zipWith`
-1 byte by porting [Dennis](https://codegolf.stackexchange.com/users/12012/dennis?tab=profile)'s [solution](https://codegolf.stackexchange.com/a/167594/48198)
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 5 bytes
```
⊥⍨¨,\
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RHXUsf9a44tEIn5v9/AwVDBSMFEAlhGSuYKJgi8ZFFzTDUmSmYK1g86lyYBhY1hMvDIIKPLIqpDgy50MxVsFQwBCoCyoCdAbbGEAcEygMA "APL (Dyalog Unicode) – Try It Online")
### How it works
```
⊥⍨¨,\
   ,\  ⍝ Convert to lists of first n elements
⊥⍨¨    ⍝ Map "Count trailing ones" to each list
```
[Answer]
# JavaScript (ES6), 22 bytes
Takes input as an array.
```
a=>a.map(s=n=>s=n*-~s)
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i5RLzexQKPYNs/WDkho6dYVa/5Pzs8rzs9J1cvJT9dI04g20DEEQwMoaaADEwHDWE29rPzMPA11HXVNTS6seg3gug3R@CgmYagjbL6hDnZogKbvPwA "JavaScript (Node.js) – Try It Online")
The shorter `a=>a.map(n=>a=n*-~a)` (20 bytes) would unfortunately fail on `[1]` because of coercion of singleton arrays to the integer they're holding.
[Answer]
# [J](http://jsoftware.com/), 4 bytes
```
#.~\
```
A port of Bubbler's APL solution
[Try it online!](https://tio.run/##y/qfVmyrp2CgYKVg8F9Zry7mvyaXkp6CepqtnrqCjkKtlUJaMRdXanJGvkIaUJUhGBpASQO4CBiiKjOAKzRE46NowlAHgTCzDHFAkA6F/wA "J – Try It Online")
# [J](http://jsoftware.com/), 8 bytes
```
i.&0@|.\
```
## How?
It's simply the distance to the preceding `0`
```
       \  for each prefix
     |.   reverse it
    @     and
i.&0      find the index of the first 0
```
[Try it online!](https://tio.run/##y/qfVmyrp2CgYKVg8D9TT83AoUYv5r8ml5KegnqarZ66go5CrZVCWjEXV2pyRr5CGlClIRgaQEkDuAgYoiozgCs0ROOjaMJQB4EwswxxQJAOhf8A "J – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~39~~ 38 bytes
-1 byte thanks to Erik the Outgolfer  
```
i=1
for x in input():i*=x;print i;i+=1
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9PWkCstv0ihQiEzD4gKSks0NK0ytWwrrAuKMvNKFDKtM7VtDf//jzbQMQRDAyhpoAMTAcNYBQA "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
‘×¥\
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw4zD0w8tjfn//3@0gY4hGBpASQMdmAgYxgIA "Jelly – Try It Online")
```
‘×¥\
   \   Accumulate the input with:
  ¥   The dyad
‘      Increment the left element
 ×    Multiply by the second element (1 or 0)
       The result always begins with the first element unchanged
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
ŒgÄF
```
[Try it online!](https://tio.run/##y0rNyan8///opPTDLW7/H@7eEvaoaQ0QHW4HEu7//xsYGhoCsYEBiAEEXCCOIYQDpqHiMDGQEkMkYGAIAA "Jelly – Try It Online")
### How it works
```
ŒgÄF  Main link. Argument: A (bit array)
Œg    Group adjacent, identical bits.
  Ä   Accumulate; take the cumulative sum of each chunk.
   F  Flatten.
```
[Answer]
# [R](https://www.r-project.org/), ~~46~~ 31 bytes
```
function(a)sequence(rle(a)$l)*a
```
[Try it online!](https://tio.run/##K/qfpmCjq6DwP600L7kkMz9PI1GzOLWwNDUvOVWjKCcVyFXJ0dRK/J@mkaxhoGMIhgZQ0kAHJgKGmpr/AQ "R – Try It Online")
`sequence`, which ["mainly exists in reverence to the very early history of R"](https://stat.ethz.ch/R-manual/R-devel/library/base/html/sequence.html), is quite handy here.
```
function(a)                       # function, taking a vector as argument
                    rle(a)$l      # take the lengths of the run-length encoding
           sequence(        )     # and generate the list [1:x for x in lengths]
                             *a   # multiply by a to maintain 0s, and return
```
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), ~~11~~ 8 bytes
**Solution:**
```
{y*1+x}\
```
[Try it online!](https://tio.run/##y9bNz/7/v7pSy1C7ojbGQMEQCA2gGAYRfGRRTHVg@P8/AA "K (oK) – Try It Online")
**Explanation:**
Iterate over the list. Increment accumulator, multiply by current item (which resets accumulator if item is 0):
```
{y*1+x}\ / the solution
{     }\ / iterate (\) over lambda function
     x   / accumulator
   1+    / add 1
 y*      / multiply by current item
```
[Answer]
# [TIS](https://github.com/Phlarx/tis), 68 + 33 = 101 bytes
Code (68 bytes):
```
@0
MOV UP ACC
SUB 47
MOV ACC ANY
@1
ADD 1
JRO UP
SUB ACC
MOV ACC ANY
```
Layout (33 bytes):
```
2 1 CC I0 ASCII - O0 NUMERIC - 32
```
[Try it online!](https://tio.run/##TcpBCoAgFATQ/T/FXEDwW9A20xYGZhQGHSFoV/f/WStnNzPvOW@RXlNMO/IC6xxteUDb/UupsPNBPZP1HkzTmgr7yUcrI8JVNIu6xIBR3qBhNxcCFJLGnOO4BldKY14 "TIS – Try It Online")
Explanation:
```
|    Input 0    |    Input is given in ASCII (`0` is 48, `1` is 49)
+--------+------+
| Node 0 |      |    This node prepares the input data
+--------+      |
| MOV UP ACC    |    Read in a character
| SUB 47        |    Subtract 47 to map [48, 49] to [1, 2]
| MOV ACC ANY   |    Send the 1 or 2 to the next node
|               |    Implicitly wrap back to top of node
+--------+------+
| Node 1 |      |    This node does the incrementing/printing
+--------+      |
| ADD 1         |    Increment counter (starts at zero)
| JRO UP        |    Get value from above, and jump forward that many lines  (skip next line or not)
| SUB ACC       |    Reset counter to zero (if input was zero)
| MOV ACC ANY   |    Send the counter value downward to be printed
|               |    Implicitly wrap back to top of node
+---------------+
|   Output 0    |    Output is space-delimited numeric values
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~45~~ ~~44~~ 38 bytes
```
f(a,i)int*a;{while(--i)*++a*=-~a[-1];}
```
[Try it online!](https://tio.run/##LUxLCoMwFNz3FI@UQmKSYpaSehKbRYhaH9go1tKFpFdPn9IZBgbmE/QjhHzGGMZ32wF7rS1O14HlnnuFAuNaeLt9Bhw7rjWKQkpf1PrrG22cTfnpMXKxnYBAZfCNgxo2o4wqieYQMdmjsr9W4u@nhe8TrEsLeKssSIniiHbMC4U9Z5f2HpmiY3Q0TPkH "C (gcc) – Try It Online")
Save one byte thanks to Toby Speight!
Save 6 bytes by using \*= and a smarter while condition.
[Answer]
# RAD, 8 bytes
```
(⊢×1+⊣)⍂
```
[Try it online!](https://tio.run/##K0pM@f9f41HXosPTDbUfdS3WfNTb9P//f0MFQwUDBUMA)
## How?
* `(⊢×1+⊣)`, if the right argument is `0`, return `0`, otherwise increment the left argument
* `⍂`, LTR Scan (`(A f B) f C` instead of `A f (B f C)`) , apply this across the array
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
ṛȧ+ɗ\
```
[Try it online!](https://tio.run/##y0rNyan8///hztknlmufnB7z////aAMdQzA0gJIGOjARMIwFAA "Jelly – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 19 bytes
```
scanl1$((*)=<<).(+)
```
[Try it online!](https://tio.run/##y0gszk7NyfmfZhvzvzg5MS/HUEVDQ0vT1sZGU09DW/N/bmJmnoKtQkFRZl6JgopCmkK0gY4hGBpASQMdmAgYxv7/l5yWk5he/F83wjkgAAA "Haskell – Try It Online")
**Explanation:**
The code is equivalent to `scanl1(\b a->(b+a)*a)`, where `b` is the current bit and `a` is the accumulator. `scanl1` takes a list, instantiates the first list element as accumulator, and folds over the list and collects the intermediate values in a new list.
*Edit: [BMO beat me by a few seconds and 4 bytes](https://codegolf.stackexchange.com/a/167588/56433).*
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 16 bytes
```
FoldList[+###2&]
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zg@98tPyfFJ7O4JFpbWVnZSC32f0BRZl5JtLKCrp1CWrRybKyCmoK@g0J1taGOggEYGcJIQ7xcqOJaHYVquDyaWgMkLgKh6ECzwBCvxfjVYLPHEJckmjG1tf8B "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# Japt, ~~7~~ ~~6~~ 5 bytes
```
åÏ*°X
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=5c8qsFg=&input=WzAsMSwxLDEsMCwxLDEsMCwwLDAsMSwxLDEsMSwxLDFdCi1R)
---
## Explanation
```
åÏ        :Cumulatively reduce
   °X     :  Increment the current total (initially 0)
  *       :  Multiply by the current element
```
[Answer]
# Java 8, ~~55~~ 48 bytes
```
a->{int p=0,i=0;for(int v:a)a[i++]=v<1?p=0:++p;}
```
Modifies the input-array instead of returning a new one to save bytes.
-7 bytes thanks to *@TimSeguine*.
[Try it online.](https://tio.run/##fVFNb4MwDL3vV/iYChqFaxmb9gPWS49VD16aTqE0oMQwVYjfztwAk7ovOYlkx@8956XEDtfl8TzqCkOAV7SufwCwjow/oTawvaUAXW2PoAXX9wfAVc7FgTevQEhWwxYcFDDi@qnnJmgKldpC5afa30DQbXCFe5skh6J7zJ75epMkTT6M@cTStG8Vs8xkUe3Cs4gdeeveo@Y0CJlAwpkPiKP0Ks1iqPlU6VKJMcRJ/0CpL1z2Lb/j@NH3H3OW/h5qQdy7Fh8aKRZnp1c6qQXOCrtrIHORdUuyYTOocqLkX5Mt2Uq@eI/XIKmejGLQrDKMnw)
**Explanation:**
```
a->{             // Method with integer-array parameter and no return-type
  int p=0,       //  Previous integer, starting at 0
      i=0;       //  Index-integer, starting at 0
  for(int v:a)   //  Loop over the values of the input-array:
    a[i++]=v<1?  //   If the current value is 0:
          p=0    //    Reset the previous integer to 0
         :       //   Else:
          ++p;}  //    Increase `p` by 1 first with `++p`
                 //    and set the current item to this new value of `p`
```
[Answer]
## Shakespeare, 365 bytes
```
I.Ajax,.Ford,.Act I:.Scene I:.[enter Ajax and Ford]Ajax:Open mind!Scene V:.Ford:Am I nicer than the sum of a big red old cute hard cat a big red old cute joy?Ford:If so,you is the sum of thyself a son!Ford:If not,you is zero!Ford:Open heart!Ajax:you is a big red old cute hard cat.Ajax:Speak mind!Ajax:Open mind!Ford:Am I nicer than zero?Ajax:If so, let us Scene V.
```
[try it here](https://tio.run/##fZA/a8MwEMW/yvNuRLJqCV4KnjoEupQMqnWpndp3RpKhzpd39CcppYRKIJ1OPz29Oz@P29aq5mK@a/Uiztaq6QJarY4dMaXgnTiQQ0Jg2CJRp3TSrzMxpoFtVeA3nSV0M6EFD118FXrDcSH4ZYKcYfAxfMKRhYwW3RIIvXExMuHZ3UXWQ5Zsz/BSr7Jg8L/1Qr96GpOuF64eKEt4sFdyUvLZbU/GhSq7vwP/OMpt0ceZzFcp80/VT4tNHx4yWDxjpIDF494itW27/X4XZxp5L@FPLo4b)
## less golfed version
```
I.Ajax,.Ford,.
Act I:.
Scene I:.
[enter Ajax and Ford]
Ajax:Open mind!
Scene V:.
Ford:Am I nicer than the sum of a big red old cute hard cat a big red old cute joy?     <- smallest way to 48 (ascii "0") I could think of
Ford:If so,you is the sum of thyself a son!
Ford:If not,you is zero!
Ford:Open heart!
Ajax:you is a big red old cute hard cat.    <- get value of 32 or space
Ajax:Speak mind!                            <- then output it
Ajax:Open mind!
Ford:Am I nicer than zero?
Ajax:If so, let us Scene V.                 <- loop through inputs
```
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 5 bytes
```
ẋ+⊣¦_
```
[Try it online!](https://tio.run/##S0/MTPz//@Gubu1HXYsPLYv/n/qobeL/aAMFQzA0gJIGCjARMIwFAA "Gaia – Try It Online")
### Explanation
```
ẋ+⊣¦_     Full program
ẋ         Split into chunks of equal adjacent values.
   ¦_     And for each chunk, flattening the result afterwards...
 +⊣       Reduce it cumulatively on + (addition); aka cumulative sums
```
Ugh, I thought SE code fonts were monospace....
[Answer]
# C++, 47 bytes
```
[](int*a,int*b){for(int c=0;a!=b;)c=*a++*=1+c;}
```
A lambda that modifies an array in place, given start and end pointers.
---
[Try it online!](https://tio.run/##ZVDbioQwDH3vV2RdWKy64Lx6@4p5m5mHWOtQ0FZqHBjEb3erVVh2EwjNSZpzEjEM308h1pGQlACcyIAweiRooYT19giVpgiTLdZ8bo3dABBlmuNHWedclBHGcVReYpEva84Y@1RadFMjC2VGshL76hdE0iIZWzFGsh86JFnQe5AaewnXih0yXkY1MFjHFHox1y9Aa/HN2czAmdMB4S72hd0ks7MKh43UZJkwE0FR@JbtEUCQs3/l4K4dvDC2Ldaj0uHJsgF0e7hDzGly2T09YpqcyO6Ln@slE/dZG@48tXy6mcQTTyt14xL@98Oy/gA "C++ (gcc) – Try It Online") (requires Javascript)
---
Generic version at 55 bytes (this works for any container with elements of arithmetic type):
```
[](auto a,auto b){for(auto c=*a-*a;a!=b;)c=*a++*=1+c;};
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~12~~ 10 bytes
```
ḅ{a₀ᵇ+ᵐ}ᵐc
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//@GO1urER00ND7e2az/cOqEWiJP//4820DHQMcQBDaAkmppYhf9RAA "Brachylog – Try It Online")
*(-2 bytes thanks to @Fatalize.)*
```
ḅ             % split input into "blocks" of equal value
 {     }ᵐ     % map this predicate on each such block:
  a₀ᵇ            % Find all prefixes (initial subsequences) of the block
                 %  Returns them in increasing order of length
     +ᵐ          % Sum the values in each subsequence
                 % This results in each block being replaced by its cumulative sum values
         c    % concatenate the results back into a single array
```
`~c{≤₁a₀ᵇ+ᵐ}ᵐc` is temptingly just out of reach at 13 bytes, but I haven't been able to find a shorter way of doing cumulative sum than the 5 byte `a₀ᵇ+ᵐ`. 
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~29 24~~ 18 bytes
*-6 bytes thanks to Sean!*
```
*.map:{($+=1)*=$_}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwX0svN7HAqlpDRdvWUFPLViW@9r81V3FipUKaRrSBjiEYGkBJAx2YCBjGasJVwlQhyxsg6TTEKo5q1n8A "Perl 6 – Try It Online")
The inner function could by `($+=1)*=*`, but then the anonymous variable would persist across function calls. We get by this by wrapping it in an explicit code block.
### Explanation:
```
*.map:               # Map the array to
      {($+=1)    }   # The anonymous variable incremented
             *=$_    # Multiplied by the element
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~48~~ ~~40~~ 25 bytes
Thanks Mazzy for -8  
Thanks AdmBorkBork for -15
```
$args[0]|%{($i=$_*=++$i)}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/XyWxKL042iC2RrVaQyXTViVey1ZbWyVTs/b///8OGgY6hmBoACUNdGAiYKgJAA "PowerShell – Try It Online")
Takes input as an array numbers. Uses the self-assigning, multiply trick other answers are using and updates everything with a very gross assignment. It then wraps this whole thing in parens to push it to output.
[Answer]
# [Pyth](https://pyth.readthedocs.io), 6 bytes
```
m=Z*hZ
```
[Try it here!](https://pyth.herokuapp.com/?code=m%3DZ%2ahZ&input=%5B0%2C1%2C1%2C1%2C0%2C1%2C1%2C0%2C0%2C0%2C1%2C1%2C1%2C1%2C1%2C1%5D+&debug=0)
### How it works
```
m=Z*hZ – Full program. Q = the evaluated input.
m      – For each integer d in Q.
 =Z    – Assign the variable Z (preinitialised to 0) to...
   *hZ – (Z + 1) * d; (d is implicit at the end).
```
[Answer]
Wanted to get an answer in using regular expressions. There is probably an easier solution which I leave as an exercise for the reader.
# [PowerShell Core](https://github.com/PowerShell/PowerShell), 86 bytes
```
Filter F{($_-split"(0)(\B|\b)"|?{$_-ne''}|%{$_-replace'(1+)',(1..$_.Length)})-join' '}
```
[Try it online!](https://tio.run/##lVNdS8MwFH3efsWldCRhS0k6PzeGolAU9MmBDyqjlugqXVubDJG2v70mXde54UMNpL099@Sce8tNmnyJTC5FFNEgyUTlreNAhUkMcyEVJv2837OVDiXM4BKTafs5nMHTw7dUYuXM12kkXiaT60z4SmCLWyO9u3GZ5rKOXP5rsdoEXBjDERzDCZzCGZwDZ8A5cBf0u6sqY1qNtw/WSDOjUW/3j4j9w2GrzluXXbxZ5iccGG362jfedXvIq/vvXk5dBWMH5uPWiu2L18KtdAED0GPRs6W/0sp6MOyFc6ud@NSgfiz1SO1Qt0YzodZZbNDmVAGeSZhcKO99FSxNsqFR8QmNkCE9ZqES9CaRCrDV0imFnJWwOSIB5bxEFn3bOoy2agTKfll5YaR0WV6O7QWVaRQqCzOCn6@K51diFRe5hmOBUFkMTJiJNPIDgTAfEjTC3HF0O3cifldLUhL6kYQxAlRW5ppUPw "PowerShell Core – Try It Online")
[Answer]
# QBasic, 60 bytes
```
INPUT s$
FOR i=1TO LEN(s$)
b=MID$(s$,i)>="1
v=-b*v-b
?v
NEXT
```
Takes the input as a string; gives the output as numbers separated by newlines.
### Explanation
We read the string `s$` and loop `i` from `1` up to its length.
`MID$(s$,i)` gets the substring from character `i` (1-indexed) to the end of the string. If this starts with a `1`, it will be lexicographically `>=` the string `"1"`; if it starts with a `0`, it will not be. So `b` gets `0` if the character at index `i` is `0`, or `-1` if the character is `1`.
Next, we update the current value `v`. If we just read a `0`, we want `v` to become `0`; otherwise, we want to increment `v` by one. In other words, `v = (-b) * (v+1)`; simplifying the math gives the shorter expression seen in the code. Finally, we print `v` and loop.
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 60 bytes
```
([]){{}<>(())<>{{}<>({}({}))(<>)}{}([])}{}<>{({}[()]<>)<>}<>
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/XyM6VrO6utbGTkNDU9PGDsKsrgUiTU0NGzvNWiAbqKQWJF4NFI3W0IwFCtvYAfn//xsoGAKhARTDIIKPLIqpDgwB "Brain-Flak – Try It Online")
# Explanation:
```
([]){  For each element in the input
    {}
    <>(())<>  Push a one to the other stack
    { If the element is one,
       {}<>({}({}))(<>)  Add the one to a copy of the previous number in the series
    }{}  Pop the element
([])}  End loop
{}<>   Pop extra zero
{({}[()]<>)<>}<>   And reverse the output stack, subtracting one from each element
```
]