Can you tell me what is wrong in the code
you dont need to replace the character you can simply print 3.14 when you encounter pi. as doing this would include changing the original string which is not recommended and moving all the characters is an inefficient as well as more error prone process.
Code: