I am currently doing a coding challenge at codesignal, challenge name is  commonCharacterCount, I have kind of made the logic below , but after troubleshooting for some time I can see the if statement is not running at all, I am not sure what the reason behind as both the typesS1Array[x]and  S2Array[i] are of String.
Any hint on this please , what I am missing here.
int commonCharacterCount(String s1, String s2) {
    
    String[] S1Array= s1.split("");
    String[] S2Array= s2.split("");
    
    int count=0;
 
    for(int x=0;x<S1Array.length;x++){
 
        // S2ArrayCopy is to check if the S2Array's array element is already been checked using 1 and 0, if 1 then count will not be updated as already checked
            int[] S2ArrayCopy= new int[S2Array.length ] ;
            Arrays.fill(S2ArrayCopy,0);
 
        for(int i=0;i<S2Array.length;i++){
          
              
                             
            if(S1Array[x] == S2Array[i] && S2ArrayCopy[i] != 1 ){
                              
                 count++;
                
               S2ArrayCopy[i]=1;
                
                break;
            }
            
            
            
        }
        
        
    }
