in reply to Read And modify a series

Why do you need the repeated 1's removed? If the last number repeated is something other than a 1, should it be pruned too? Some of the solutions you've been given could be easily modified to allow for that.

Dum Spiro Spero