Why all testcaes not passed

#include
using namespace std;
#include
#include<math.h>

int main()
{

long long int n,n_new=0;
cin>>n;

int power=0;

while(n>0){

    long long int t = n%10;
    long long int min_x_t = min(t,9-t);
    long long int p = min_x_t * (pow(10,power));
    n_new = n_new + p;


    power++;
    n=n/10;
}

cout<<n_new;

}

why all test cases not passed ?

@Kirtee2002
hello devkishan,
if most significant digit is 9 and then dont convert it to 0 becuase it will give leading zeros.

for ex-> if input is 9981 then output should be 9011

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.