compute unique combinations of a substring