Brain-Flak, 30 bytes
(()){{}({}{{}}<><{}>)<>([])}<>
Explanation
(()) #{ Start Loop. Used instead of ([]) so that the loop will run at least once on empty input. }
{{} #{Remove the stack height. }
(
{}{{}} #{ Add the TOS with any 1s below it (until a zero). }
<><{}> #{ Remove a value on the other stack if there. }
) #{ Push the result (# of 1s just removed) to the other stack. }
<> #{ Switch stacks back. }
([]) #{ Push stack height for the loop. }
} #{ Once the loop is done (stack is empty)... }
<> #{ Switch stacks to the most recent # of 1s removed. }
Brain-Flak, 30 bytes
(()){{}({}{{}}<><{}>)<>([])}<>
Explanation
(()) #{ Start Loop. Used instead of ([]) so that the loop will run at least once on empty input. }
{{} #{Remove the stack height. }
(
{}{{}} #{ Add the TOS with any 1s below it (until a zero). }
<><{}> #{ Remove a value on the other stack if there. }
) #{ Push the result (# of 1s just removed) to the other stack. }
<> #{ Switch stacks back. }
([]) #{ Push stack height for the loop. }
} #{ Once the loop is done (stack is empty)... }
<> #{ Switch stacks to the most recent # of 1s removed. }