Tell my mistake in this code why this one test case isnt passing

#include

using namespace std;

int reverse(int temp){
int ans=0;
while(temp>0){
int rem = temp%10;
ans = ans*10 + rem;
temp = temp/10;
}
return ans;
}
int replace(long long int n){
if(n == 0){
return 5;
}

else{
	int x=0;
	int temp=0;

	while(n>0){
		x = n%10;
		if(x == 0){
			x = 5;
		}
		temp = temp*10 + x;
		n=n/10;
}
return reverse(temp);
}

}

int main()
{
long long int n;
cin>>n;
if(n<0){
n=n*(-1);
cout << -1*(replace(n));
}
else{
cout << replace(n);
}
return 0;
}

hi @utkarsh.gupta0311 refer https://ide.codingblocks.com/s/667539