hello sir , here is the code of my question number 2 in arrays assignment . and i can’t find out why my solution is not passing 2 test cases.
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
String res ="";
for(int i=0;i<str.length();i++){
int a=Character.getNumericValue( str.charAt(i) );
int b = 9-a;
if(res == "" && b==0 ){
if(a==0){
}
if(b==0){
}
}
else{
if(a>b){
res= res+ b;
}else{
res = res+a;
}
}
}
System.out.println(res);
}
}