Whats the mistake in this code..i am not getting the output

It is because of line 7 if(str>a)
You cannot directly compare a character array. It would work if it was an STL based string.

Also It is given that the output must be in sorted order. If you print in base case,it is not guaranteed that your output will be sorted. For that…instead of printing in base case…you must push it in a vector in the base case.You should then sort the resulting vector in the main before printing the final result.
Refer this
https://ide.codingblocks.com/s/285431