my code was working fine when i was taking all the inputs on different lines but to take input on same lime i modified my code
but now again its not working fine please tell me the error
the code is
Scanner scn=new Scanner(System.in);
String n1= scn.nextLine();
int n=Integer.parseInt(n1);
for(int j=0;j<n;j++) {
String str=scn.nextLine();
String[] string = str.split("");
String str1=string[0];
String str2=string[1];
String str3="";
for(int i=0;i<str1.length();i++) {
if(str1.charAt(i)==str2.charAt(i)) {
str3+='0';
}
else {
str3+='1';
}
}
System.out.println(str3);
}