You need to be more specific about the grouping rules. Tells us exactly which substrings should be ignored, giving a lot of examples, including negative ones: give examples of files that should be grouped together and as well as ones of files that should not. Be as clear as possible. Here's an example of examples :tongue: you could give:
hotchickens.txt
hotdogs.txt
coldchickens.txt
First of all, are there going to be files like this (ie ones that share different substrings)? If yes, should hotchickens.txt be grouped with hotdogs.txt (because of "hot") or should it be grouped with coldchickens.txt (because of "chickens")? Try to translate the rules to something that can be programmed, e.g. "all files of the same food should be put together" doesn't say much, but "all file names that end in the same string of letters should be put together" does say something about the coding approach.
It would be even better if you figured out the algorithm yourself and only asked us to implement it in mirc.