I have a list with the following string values.
[4|oo44|oo44|oo44|244, 2|oo|oo|oo|519,548, 3|oo33|oo33|oo33|024,900, 1|header1|id1|class1|466]
Based on this input value, I have created a new list with the required values (first and last value in each item). So my final list has
4:244
2:519
2:548 //2 is duplicated here since the input has two values related to the row number 2.
3:024
3:900 //3 is duplicated here since the input has two values related to the row number 3.
1:466
Now, I have to sort these items and then wherever I have duplicate values(in this case 2 and 3), those items should be re-numbered.
After sorting I would get
1:466 //should remain same in final list
2:519 //should remain same in final list
2:548 //should be changed to 3:548
3:024 //should be changed to 4:024
3:900 //should be changed to 5:900
4:244 //should be changed to 6:244
The expected output is
1:466
2:519
3:548
4:024
5:900
6:244
Any help would be much appreciated.