Replace All PI Problem by recursion


This is the solution of problem replace all pi by recursion.I am not able to figure out why the error is giving up index out of bound.

Your code tries to access res.substring(0,2 ) even when res is empty

I got it Thank You So Much for helping