I am looking for an elegant solution for the following problem.

I have a list of `ints`

and I want to create a list of lists where the indices with the same value are grouped together in the order of the occurrences of said list.

`[2, 0, 1, 1, 3, 2, 1, 2]`

should yield `[[0, 5, 7], [1], [2, 3, 6], [4]]`

My solution so far:

```
list = [2, 0, 1, 1, 3, 2, 1, 2]
cc = [[] for i in range(max(list)+1)]
for x in range(0, max(list)+1):
cc[x] = []
for i, j in enumerate(list):
if j == x:
cc[x].append(i)
print("cc: ", cc)
```

yields `[[1], [2, 3, 6], [0, 5, 7], [4]]`

, which is obviously in the wrong order.