I already searched every question related to this error on StackOverflow but trust me my case is different here. actually, I am preparing for competitive level programming skills and I solved this question successfully on the laptop and the output is 100%true without any type of error for this question of hacker earth (link below)-
but when I try to submit my code on hacker earth it throws an error and now I am really confused that why error comes when it successfully ran on my laptop.
the error screenshot below -
here is my code -
import java.util.*;
class nalin{
public static void main(String args[]){
Scanner bob = new Scanner(System.in);
int bobs = bob.nextInt();
String result[] = new String[bobs];
for(int g = 0; g<bobs; g++){
Scanner s = new Scanner(System.in);
String x = s.nextLine();
String arr[] = x.split("\\s+");
int coun = 0;
char v1[] = arr[0].toCharArray();
char v2[] = arr[1].toCharArray();
for(int i = 0; i<v1.length; i++){
for(int j = 0; j<v2.length; j++){
if(v1[i] == v2[j]){
coun = coun+1;
break;
}
}
}
if(coun == v1.length){
result[g] = "YES";
}else{
result[g] = "NO";
}
}
for(int l = 0; l<result.length; l++){
System.out.println(result[l]);
}
}
}