private static int count ( String ans , char [ ] c , char ch ) {
  int diff = 0 ;
  for ( int i = 0 ;
  i < ans . length ( ) ;
  i ++ ) {
    diff += S . charAt ( i ) == ans . charAt ( i ) ? 0 : 1 ;
  }
  if ( ch != S . charAt ( ans . length ( ) ) ) diff ++ ;
  int [ ] a = new int [ 26 ] ;
  for ( char b : c ) {
    if ( b == '\0' ) continue ;
    a [ b - 'a' ] ++ ;
  }
  a [ ch - 'a' ] -- ;
  for ( int i = ans . length ( ) + 1 ;
  i < S . length ( ) ;
  i ++ ) {
    int idx = S . charAt ( i ) - 'a' ;
    if ( a [ idx ] > 0 ) {
      a [ idx ] -- ;
    }
    else {
      diff ++ ;
    }
  }
  return diff ;
}

private static int count ( String ans , char [ ] c , char ch ) { int diff = 0 ; for ( int i = 0 ; i < ans . length ( ) ; i ++ ) { diff += S . charAt ( i ) == ans . charAt ( i ) ? 0 : 1 ; } if ( ch != S . charAt ( ans . length ( ) ) ) diff ++ ; int [ ] a = new int [ 26 ] ; for ( char b : c ) { if ( b == ' \0' ) continue ; a [ b - ' a ' ] ++ ; } a [ ch - ' a ' ] -- ; for ( int i = ans . length ( ) + 1 ; i < S . length ( ) ; i ++ ) { int idx = S . charAt ( i ) - ' a ' ; if ( a [ idx ] > 0 ) { a [ idx ] -- ; } else { diff ++ ; } } return diff ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) consequence: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (continue_statement)) (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (character_literal))))))) (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (character_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (array_access array: (identifier) index: (identifier))))) alternative: (block (expression_statement (update_expression (identifier))))))) (return_statement (identifier))))