Generating All Permutations of Input String