static int beauty ( String s , int n ) {
  int cnt [ ] = new int [ 128 ] ;
  for ( int i = 0 ;
  i < s . length ( ) ;
  i ++ ) {
    char c = s . charAt ( i ) ;
    cnt [ c ] ++ ;
  }
  for ( char c = 'a' ;
  c <= 'z' ;
  c ++ ) {
    if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ;
    else {
      cnt [ c ] += n ;
      cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ;
    }
  }
  for ( char c = 'A' ;
  c <= 'Z' ;
  c ++ ) {
    if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ;
    else {
      cnt [ c ] += n ;
      cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ;
    }
  }
  int max = 0 ;
  for ( int i = 0 ;
  i < 128 ;
  i ++ ) {
    max = Math . max ( max , cnt [ i ] ) ;
  }
  return max ;
}

static int beauty ( String s , int n ) { int cnt [ ] = new int [ 128 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; cnt [ c ] ++ ; } for ( char c = ' a ' ; c <= ' z ' ; c ++ ) { if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ; else { cnt [ c ] += n ; cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ; } } for ( char c = ' A ' ; c <= ' Z ' ; c ++ ) { if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ; else { cnt [ c ] += n ; cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ; } } int max = 0 ; for ( int i = 0 ; i < 128 ; i ++ ) { max = Math . max ( max , cnt [ i ] ) ; } return max ; }
(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: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) 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: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (character_literal))) condition: (binary_expression left: (identifier) right: (character_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (array_access array: (identifier) index: (identifier)))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (character_literal))) condition: (binary_expression left: (identifier) right: (character_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (array_access array: (identifier) index: (identifier)))))))))) (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))))) (return_statement (identifier))))