1 2 3 4 5 6 7 8 9 10 11 12 13
| >>> a = [1,2,2,3,3,3,4,4,4,4,5,5,5,5,5] >>> slice_by_len([1,2,3,4,5], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5, 5]] >>> slice_by_len([1,2,3,4,10], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5, 5]] >>> slice_by_len([1,2,3,4], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5, 5]] >>> slice_by_len([1,2,3,3], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4], [4, 5, 5, 5, 5, 5]] >>> slice_by_len([1,2,3,100,1000], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4, 5, 5, 5, 5, 5]] >>> slice_by_len([1,2,3,3,3,3,3,3,8,9], a) [[1], [2, 2], [3, 3, 3], [4, 4, 4], [4, 5, 5], [5, 5, 5]]
|