my code is working fine and giving the desired output in my eclipse but not getting accepted. Can sm1 plz point out the error.
/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class WildcardMatching {
public static void main(String[] args) throws java.lang.Exception {
try {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
int t = sc.read() - ‘0’;
sc.readLine();
while (t-- > 0) {
String firstString = sc.readLine();
String secondString = sc.readLine();
int length = firstString.length();
for (int i = 0; i < length; i++) {
if (firstString.charAt(i) != secondString.charAt(i) ) {
if (firstString.charAt(i)!= '?' && secondString.charAt(i) != '?') {
//System.out.println(firstString.charAt(i) );
// System.out.println(secondString.charAt(i) );
System.out.println("No");
break;
}
}
if (i == (length - 1)) {
System.out.println("Yes");
}
}
}
} catch (Exception e) {
}
}
}