Ordering derived segmented data lists to the order the originating list


I am generating colour codes through the count of a range of items with in a list which meet a filtered count. I would like to keep the string.contains as the way to grab the count for the data as it allows manual input and creation and adding of extra “codes” more clear then using the index of the “Code”. (Unless someone has more intuitive way?)

As I am separating the data, how can I order all the colours codes I generate back to the order of the original list aligning and ordering it exactly. I have the data in a Group by Key List and just one Long List aswell to help, but not sure how I can utilize this. Hope that makes sense! I have achieved it by just ensuring I lace them in order in the List.Create but not very automated and I have 46 Sets! Thank you in advance!