Generates all possible permutations of characters within a string