I have a list (not sure what to call it) $L$ containing $n$ elements $e_i^{[k]}$ where $[k]$ is a natural number that indicates a group label for any given element and the lower index $i$ is an index given to distinguish elements from each other. The list might look something like the following $L = [ e_0^{[0]}, e_1^{[2]}, e_2^{[0]}, e_3^{[1]} ] $.
The question is, in how many ways is it possible to partition an arbitrary list (i.e. group the elements) on the conditions:
$i)$ Only elements with the same group label $[k]$ may be partitioned together.
$ii)$ We only consider positions where an element is moved from right to left, so for instance $L_1$ is feasible whereas $L_2$ is not because element $e_0^{[0]}$ moved from left to right.
So in the example above the answer is one ($L_1$ is the solution):
$L_1 = [ [e_0^{[0]}e_2^{[0]}], e_1^{[2]}, e_3^{[1]} ] $
$L_2 = [ e_1^{[2]}, [e_0^{[0]}e_2^{[0]}], e_3^{[1]} ] $
The position between groups is considered but not the position within groups and we don't consider cases where no change has been done at all, i.e. $L$ itself doesn't count. Moreover it is not necessary for all elements with the same group label $[k]$ to be grouped, i.e. we consider all combinations.
Possible solution:
I'm guessing maybe this could be solved by using Stirling numbers of the second kind somehow. If we count all the elements that correspond to a specific label $[k]$ we can solve that sub-problem with Stirling numbers. Maybe we can combine the solutions to each sub-problem and get the total?