Help me in solving CODEOW problem

My issue

My code

#include <iostream>
using namespace std;
#include<string>
#include<bits/stdc++.h>
int length(char  input[])
{
    int count=0;
    for(int i=0;input[i]!='\0';i++)
    {
        count++;
    }
    return count;
        
}
void replacePi(char input[])
{
    if (input[0] == '\0')
    {
        return;
    }
    replacePi(input + 1);
    int n=length(input);
    if(input[0]=='p'&&input[1]=='i')
    {
        for(int i=n-1;i>=2;i--)
        {
            input[i+2]=input[i];
        }
    
    input[0]='3';
    input[1]='.';
    input[2]='1';
    input[3]='4';
}
}
int main() {
	// your code goes here
	int T;
	cin>>T;
	while(T--)
	{
	    char str[1000];
	     cin.getline(str, 10000);
	    replacePi(str);
	    cout<<str<<endl;
	 
	}
	return 0;
}

Problem Link: CODEOW Problem - CodeChef