Recursion-codes of the string

Why is my solution not getting accepted? It is giving the same output.