Mapped Strings (Recursion)

My Code–> https://ide.codingblocks.com/s/62850
Please Check my code.
I am taking the input number (num) as a string so that it would be easier to extract single digit and double digit number. Facing problem in extracting a double digit using substring in the function

How to deal with this error "request for member ‘substr’ in ‘in’, which is of non-class type ‘char*’ "

https://ide.codingblocks.com/s/62853
Even for this modified code where there is no error. Why there are so many outputs? How is recursion tree following?
I have made the code following this tree:
123

  1----------------    12
/  \                   /

1,2__1,23_____________12,3
/ ____( AW) ___________(LC)
1,2,3
(ABC)

How to implement it correctly?

https://ide.codingblocks.com/s/65736

i have removed the loop from line 33 and now it is giving the correct answer

1 Like