static int countSubStrings ( String s , String anotherStr , int k ) {
  boolean illegal [ ] = new boolean [ MAX_CHAR ] ;
  for ( int i = 0 ;
  i < anotherStr . length ( ) ;
  i ++ ) {
    illegal [ anotherStr . charAt ( i ) ] = true ;
  }
  HashSet < String > us = new HashSet < String > ( ) ;
  for ( int i = 0 ;
  i < s . length ( ) ;
  ++ i ) {
    String ss = "" ;
    int count = 0 ;
    for ( int j = i ;
    j < s . length ( ) ;
    ++ j ) {
      if ( illegal [ s . charAt ( j ) ] ) {
        ++ count ;
      }
      ss = ss + s . charAt ( j ) ;
      if ( count <= k ) {
        us . add ( ss ) ;
      }
      else {
        break ;
      }
    }
  }
  return us . size ( ) ;
}

static int countSubStrings ( String s , String anotherStr , int k ) { boolean illegal [ ] = new boolean [ MAX_CHAR ] ; for ( int i = 0 ; i < anotherStr . length ( ) ; i ++ ) { illegal [ anotherStr . charAt ( i ) ] = true ; } HashSet < String > us = new HashSet < String > ( ) ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { String ss = " " ; int count = 0 ; for ( int j = i ; j < s . length ( ) ; ++ j ) { if ( illegal [ s . charAt ( j ) ] ) { ++ count ; } ss = ss + s . charAt ( j ) ; if ( count <= k ) { us . add ( ss ) ; } else { break ; } } } return us . size ( ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier))))) (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: (array_access array: (identifier) index: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (true))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (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 (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (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: (identifier))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (break_statement))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))