// Ben Stoddard
// APT 3 Common Example

public class Common {
  public int count (String a, String b) {
    char[] arrayB = b.toCharArray();
    
    int count = 0;
    
    for(int i = 0; i < a.length(); i++){
      char aSub = a.charAt(i);
      
      int positionB = b.indexOf(aSub);
      
      if(positionB >= 0){
        arrayB[positionB] = '@';
        count++;
        b = new String(arrayB);
      }
      
    }
    
    return count;
  }
}