Sir, My code gives the correct output but for testcase 3 and 5 it gives the wrong answer: please help:
Here is my code:
import java.util.;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
int i;
long s=0;
long number;
for(i=0;n%10!=0 || n/10!=0;n/=10,i++) {
number=n%10;
if(9-number>number)
s=(long) (s+(numberMath.pow(10, i)));
else
s=(long) (s+((9-number)*Math.pow(10, i)));
}
System.out.println(s);
sc.close();
}
}