I am Getting WA Plz help

i have passed all the test cases and corner cases but still i’m getting WA do anyone know which test case is failing this is the question link: Contest Page | CodeChef
Here is my code:
#include iostream
#include string
using namespace std;
int main()
{
int t;cin>>t;
while(t–)
{
string k;cin>>k;
bool flag=true;
for(int i=0;i<k.length();i++)
{
if(k[i]!=‘9’)
{
flag=false;
break;
}
}
if(flag==true)
{
int z=k.length()-1;
cout<<‘1’+string(z,‘0’)+‘1’<<"\n";
continue;
}
if(((k.length())&1)==0)//even
{
int mid=(k.length()-1)/2;
if(k[mid]<k[mid+1])
{
int temp;
temp=int(k[mid]-48);
temp++;
k[mid]=char(temp+48);
k[mid+1]=k[mid];
int pR=mid+2,pL=mid-1;
while(pL>=0)
{
k[pR]=k[pL];
pR++;pL–;
}
}
else if(k[mid]>k[mid+1])
{
k[mid+1]=k[mid];
int pR=mid+2,pL=mid-1;
while(pL>=0)
{
k[pR]=k[pL];
pR++;pL–;
}
}
else
{
int pR=mid+2,pL=mid-1;
while(k[pR]==k[pL])
{
if(pL<0)
{
if(k[mid]==‘9’)
{
pL=mid-1;pR=mid+2;
while(k[pL]==‘9’)
{
pR++;pL–;
}
int temp=int(k[pL]-48);
temp++;
k[pL]=char(temp+48);
for(int i=pL+1;i<=pR-1;i++)
{
k[i]=‘0’;
}
while(pL<0)
{
k[pR]=k[pL];
pL–;pR++;
}
}
else
{
int temp=int(k[mid]-48);
temp++;
k[mid]=char(temp+48);
k[mid+1]=k[mid];
}
break;
}
pL–;pR++;
}
if(k[pL]<k[pR])
{
if(k[mid]==‘9’)
{
pL=mid-1;pR=mid+2;
int temp=int(k[pL]-48);
temp++;
k[pL]=char(temp+48);
for(int i=pL+1;i<=pR-1;i++)
{
k[i]=‘0’;
}
while(pL>=0)
{
k[pR]=k[pL];
pR++;pL–;
}
}
else
{
int temp=int(k[mid]-48);
temp++;
k[mid]=char(temp+48);
k[mid+1]=k[mid];
while(pL>=0)
{
k[pR]=k[pL];
pR++;pL–;
}
}
}
else
{
while(pL>=0)
{
k[pR]=k[pL];
pR++;pL–;
}
}

        }
    }
    else//odd
    {
        int mid=(k.length()-1)/2;
        if(k[mid-1]>k[mid+1])
        {
            int pL=mid-1;
            int pR=mid+1;
            while(pL>=0)
            {
                k[pR]=k[pL];
                pL--;
                pR++;
            }
        }
        else if(k[mid-1]<k[mid+1])
        {
            int temp=int (k[mid]-48);
            temp++;
            k[mid]=char(temp+48);
            int pL=mid-1;
            int pR=mid+1;
            while(pL>=0)
            {
                k[pR]=k[pL];
                pL--;
                pR++;
            }
        }
        else
        {
            int pL=mid-1;
            int pR=mid+1;
            while(k[pL]==k[pR])
            {
                if(pL<0)
                {
                    if(k[mid]=='9')   
                    {
                        pL=mid-1;pR=mid+1;
                        while(k[pL]=='9')
                        {
                            pR++;pL--;
                        }
                        int temp=int(k[pL]-48);
                        temp++;
                        k[pL]=char(temp+48);
                        for(int i=pL+1;i<=pR-1;i++)
                        {
                            k[i]='0';
                        }
                        while(pL<0)
                        {
                            k[pR]=k[pL];
                            pL--;pR++;
                        }
                    }  
                    else
                    {
                        int temp=int(k[mid]-48);
                        temp++;
                        k[mid]=char(temp+48);
                    } 
                    break;
                } 
                pL--;
                pR++;
            }
            if(k[pL]<k[pR])
            {
                pL=mid-1;pR=mid+1;
                if(k[mid]=='9')
                {      
                    while(k[pL]=='9')  
                    {
                        pL--;pR++;
                    }                
                    int temp=int(k[pL]-48);
                    temp++;
                    k[pL]=char(temp+48);
                    for(int i=pL+1;i<=pR-1;i++)
                    {
                        k[i]='0';
                    }
                    while(pL>=0)
                    {
                        k[pR]=k[pL];
                        pL--;
                        pR++;
                    }
                }
                else
                {
                    int temp=int(k[mid]-48);
                    temp++;
                    k[mid]=char(temp+48);
                    while(pL>=0)
                    {
                        k[pR]=k[pL];
                        pL--;
                        pR++;
                    }
                }                    
            }
            else 
            {
                while(pL>=0)
                {
                    k[pR]=k[pL];
                    pL--;
                    pR++;
                }
            }
        }
    }
    cout<<k<<endl;
}

}

please send properly formatted code : )

then only people can help you

You can also share your submission link if that is convenient.