static void permuteRec ( String str , int n , int index , String curr ) {
  if ( index == n ) {
    return ;
  }
  System . out . println ( curr ) ;
  for ( int i = index + 1 ;
  i < n ;
  i ++ ) {
    curr += str . charAt ( i ) ;
    permuteRec ( str , n , i , curr ) ;
    curr = curr . substring ( 0 , curr . length ( ) - 1 ) ;
  }
  return ;
}

static void permuteRec ( String str , int n , int index , String curr ) { if ( index == n ) { return ; } System . out . println ( curr ) ; for ( int i = index + 1 ; i < n ; i ++ ) { curr += str . charAt ( i ) ; permuteRec ( str , n , i , curr ) ; curr = curr . substring ( 0 , curr . length ( ) - 1 ) ; } return ; }
(method_declaration (modifiers) type: (void_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)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))))) (return_statement)))