/* package whatever; // 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 Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
String x = "cat" ;
String y = "cot" ;

int[] codePointsX = x.codePoints().toArray() ;
int[] codePointsY = y.codePoints().toArray() ;

boolean sameLength = ( codePointsX.length == codePointsY.length ) ;
if ( ! sameLength ) { 
	throw new IllegalArgumentException( "The two input strings have different lengths. " ) ;
}

int[] results = new int[ codePointsX.length ] ;

for( int index = 0 ;  index < codePointsX.length ; index ++ ) 
{
    results[ index ] = 
        codePointsX[ index ] == codePointsY[ index ] ? 1 : 0 ;
}

int countMatches = Arrays.stream( results ).sum();

System.out.println( Arrays.toString( results ) ) ;
System.out.println( "countMatches = " + countMatches ) ;
	}
}