I am new with C++, can anyone help me with the following code. I will be highly thankful.

Write a recursive function that has two inputs, first and second, which both are strings(from ). The function should print all rearrangements of letters in first, followed by second. For example, if first is the string “CAT” and second is the string “MAN”, then the function would print the strings TACMAN, ATCMAN, CTAMAN, TCAMAN, ACTMAN, and CATMAN. The stopping case of the function occurs when the length of first has zero characters.


Just remove a letter from the first string, print that letter, and do a recursive call. Of course, you'll want to do this for each letter.