Baker Hughes Interview Question

write a program to print all permutations of a string XYZ using recursion. input string XYZ output string : XYZ, XZY, YZX, YXZ, ZXY, ZYX swap the first and last character of each words in the given string String STR = java is object oriented language Output : aavj si tbheco drientedo eanguagl