Regarding my string "test"

what i am trying to do is i am storing the input string “s” value in another string called “output”. I took a third string called “test” initialised as null and reason for taking “test” string is so that i can check if the output string which i am printing is not same as the previous one . I have commented out my logic in the code

The only problem is the “test” string is automatically getting null value after the statement return is executed and not saving the output string “s” in it .

“test” string stores the value of “s” in base case but as soon as base case encounters return , the value stored in “test” is lost and becomes null.

for this you have to pass test string by reference

Modified Code