Help me in solving TWOSTR problem

My issue

My logic is correct.But it is showing error.Please help me

My code

/* 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 Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes hereif
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		while(n-->0)
		{
		    boolean canMatch=true;
		    String X=sc.nextLine();
		    String Y=sc.nextLine();
		    char[] ch1=X.toCharArray();
		    char[] ch2=Y.toCharArray();  
		    for(int i=0;i<ch1.length;i++)
		    {
		    if(ch1[i]!='?' && ch2[i]!='?') 
		    {
		         if(X.charAt(i) !=  Y.charAt(i)) {
		            canMatch = false;
		            System.out.println(X.charAt(i)+" "+Y.charAt(i));
		            break;
		        }
		    }
		    }
		    if(canMatch)
		    System.out.println("Yes");
		    else
		    System.out.println("No");
		}
	    	
	}
}

Problem Link: CodeChef: Practical coding for everyone