Added code to generate all permutations of a given string