static int totalOperations ( String str , int len ) {
  HashMap < Character , Integer > h = new HashMap < Character , Integer > ( ) ;
  for ( int i = 0 ;
  i < len ;
  i ++ ) {
    if ( h . containsKey ( str . charAt ( i ) ) ) h . put ( str . charAt ( i ) , h . get ( str . charAt ( i ) ) + 1 ) ;
    else h . put ( str . charAt ( i ) , 1 ) ;
  }
  Set < Map . Entry < Character , Integer >> set = h . entrySet ( ) ;
  HashSet < Integer > hs = new HashSet < Integer > ( ) ;
  for ( Map . Entry < Character , Integer > me : set ) hs . add ( me . getValue ( ) ) ;
  return hs . size ( ) ;
}

static int totalOperations ( String str , int len ) { HashMap < Character , Integer > h = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( h . containsKey ( str . charAt ( i ) ) ) h . put ( str . charAt ( i ) , h . get ( str . charAt ( i ) ) + 1 ) ; else h . put ( str . charAt ( i ) , 1 ) ; } Set < Map . Entry < Character , Integer > > set = h . entrySet ( ) ; HashSet < Integer > hs = new HashSet < Integer > ( ) ; for ( Map . Entry < Character , Integer > me : set ) hs . add ( me . getValue ( ) ) ; return hs . size ( ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier) (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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) (decimal_integer_literal))))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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)))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (identifier) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))