Amazon interview question

Write a program to get all permutations of a string