Given a string of digits or an integer as input, you will have to indexize it.
This is how you modify the input. We will use 30043376111
as an example:
First, find the sum of the indices of each occurrence of the respective digits:
0: 1 + 2 = 3
1: 8 + 9 + 10 = 27
3: 0 + 4 + 5 = 9
4: 3
6: 7
7: 6
Then, construct a new integer or string where the digits above go in the order of the sums of their indices. In the case that multiple digits yield the same sum, the smaller digit comes before the larger one:
047631
Finally, remove any leading zeroes, and return or print the result:
47631
You must write a program or function which returns or prints the input indexized.
This is code-golf, so shortest code in bytes wins!
More test cases can be added if requested.