Replace all pi (i think logic is wrong)

Take two strings, one the input string (processed) and one empty string (unprocessed) for the answer.
Recursively scan each character while moving up in the recursion stack.
If the scanned character is ā€˜pā€™ check for the next character. If it is ā€˜iā€™ then update then unprocessed string and increment the pointer by 2. Else, just copy and concatenate the processed character to the unprocessed string and increment the pointer by 1.
Hope this helps

Also, take user input