The code runs on local machine but gives runtime error on cb ide

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
// sc.nextLine();
for(int a=0;a<n;a++){
String s1=sc.nextLine();

		String s2=sc.nextLine();
		String result="";

	for(int i=0;i<s1.length();i++){
		if(s1.charAt(i)==s2.charAt(i)){
			result=result+"0";
		}
		else{
							result=result+"1";

		}
	}
	System.out.println(result);



	}
	


}

}

@ashutosh2 There is difference between using scn.nextLine() and scn.next(). Follow the given link and the corrected code is also attached below.
https://stackoverflow.com/questions/22458575/whats-the-difference-between-next-and-nextline-methods-from-scanner-class#:~:text=next()%20can%20read%20the,end%20of%20line%20\n%20).

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
// sc.nextLine();
for(int a=0;a<n;a++){
	sc.nextLine();
String s1=sc.next();

		String s2=sc.next();
		String result="";

	for(int i=0;i<s1.length();i++){
		if(s1.charAt(i)==s2.charAt(i)){
			result=result+"0";
		}
		else{
							result=result+"1";

		}
	}
	System.out.println(result);
	}
}
}