American Express interview question

Generate all permutations of a string.