Memory Limit exceeding error


#1

My solution is correct but it shows memory limit exceeded.
Please Help
Thanks in advance


#2

Make sure you are passing string in recursion as const reference