static void Rearrange ( String str ) {
  String odd = "" , even = "" ;
  for ( int i = 0 ;
  i < str . length ( ) ;
  ++ i ) {
    if ( str . charAt ( i ) % 2 == 0 ) {
      even += str . charAt ( i ) ;
    }
    else {
      odd += str . charAt ( i ) ;
    }
  }
  odd = sort ( odd ) ;
  even = sort ( even ) ;
  if ( check ( odd + even ) ) {
    System . out . print ( odd + even ) ;
  }
  else if ( check ( even + odd ) ) {
    System . out . print ( even + odd ) ;
  }
  else {
    System . out . print ( - 1 ) ;
  }
}

static void Rearrange ( String str ) { String odd = " " , even = " " ; for ( int i = 0 ; i < str . length ( ) ; ++ i ) { if ( str . charAt ( i ) % 2 == 0 ) { even += str . charAt ( i ) ; } else { odd += str . charAt ( i ) ; } } odd = sort ( odd ) ; even = sort ( even ) ; if ( check ( odd + even ) ) { System . out . print ( odd + even ) ; } else if ( check ( even + odd ) ) { System . out . print ( even + odd ) ; } else { System . out . print ( - 1 ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) 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: (decimal_integer_literal))) 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 (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))))))))