static boolean check ( String str , int m , int k ) {
  int [ ] freq = new int [ 26 ] ;
  for ( int i = 0 ;
  i < m ;
  i ++ ) freq [ str . charAt ( i ) - 'a' ] ++ ;
  if ( isPalindrome ( freq , k ) ) return true ;
  for ( int i = m ;
  i < str . length ( ) ;
  i ++ ) {
    freq [ str . charAt ( i - m ) - 'a' ] -- ;
    freq [ str . charAt ( i ) - 'a' ] ++ ;
    if ( isPalindrome ( freq , k ) ) return true ;
  }
  return false ;
}

static boolean check ( String str , int m , int k ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < m ; i ++ ) freq [ str . charAt ( i ) - ' a ' ] ++ ; if ( isPalindrome ( freq , k ) ) return true ; for ( int i = m ; i < str . length ( ) ; i ++ ) { freq [ str . charAt ( i - m ) - ' a ' ] -- ; freq [ str . charAt ( i ) - ' a ' ] ++ ; if ( isPalindrome ( freq , k ) ) return true ; } return false ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (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))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal)))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) consequence: (return_statement (true))) (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 (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (character_literal))))) (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) consequence: (return_statement (true))))) (return_statement (false))))