Amazon interview question

Write a program to print all permutations of a string.