I have a list where a few distinct numbers occur, e.g.
{41, 41, 41, 1009, 41, 41, 41, 41, 41, 41, 41, 1009, 41, 41, 41}
I want to extract the information of how many times in a row each number occurs. For the above list,
{{3,7},{1}}
I actually already have something that works, but it seems excessively complicated and amateurish. Any ideas to improve this?
(Take[#, All, {2}] // Flatten) & /@
Sort[
GatherBy[{#[[1]], Length[#]} & /@ Union@Split@INPUTLIST,
First],
First@First[#1] < First@First[#2] &]