Amazon Interview Question

Write a program to print all permutations of a string.