static String findLongestPalindrome ( String str ) {
  int count [ ] = new int [ 256 ] ;
  for ( int i = 0 ;
  i < str . length ( ) ;
  i ++ ) {
    count [ str . charAt ( i ) ] ++ ;
  }
  String beg = "" , mid = "" , end = "" ;
  for ( char ch = 'a' ;
  ch <= 'z' ;
  ch ++ ) {
    if ( count [ ch ] % 2 == 1 ) {
      mid = String . valueOf ( ch ) ;
      count [ ch -- ] -- ;
    }
    else {
      for ( int i = 0 ;
      i < count [ ch ] / 2 ;
      i ++ ) {
        beg += ch ;
      }
    }
  }
  end = beg ;
  end = reverse ( end ) ;
  return beg + mid + end ;
}

static String findLongestPalindrome ( String str ) { int count [ ] = new int [ 256 ] ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { count [ str . charAt ( i ) ] ++ ; } String beg = " " , mid = " " , end = " " ; for ( char ch = ' a ' ; ch <= ' z ' ; ch ++ ) { if ( count [ ch ] % 2 == 1 ) { mid = String . valueOf ( ch ) ; count [ ch -- ] -- ; } else { for ( int i = 0 ; i < count [ ch ] / 2 ; i ++ ) { beg += ch ; } } } end = beg ; end = reverse ( end ) ; return beg + mid + end ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) 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 (expression_statement (update_expression (array_access array: (identifier) index: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal)) declarator: (variable_declarator name: (identifier) value: (string_literal)) declarator: (variable_declarator name: (identifier) value: (string_literal))) (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: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (update_expression (array_access array: (identifier) index: (update_expression (identifier)))))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))))