static ArrayList < ArrayList < String >> addStrings ( ArrayList < ArrayList < String >> v , String s , ArrayList < String > temp , int index ) {
  int len = s . length ( ) ;
  String str = "" ;
  ArrayList < String > current = new ArrayList < > ( temp ) ;
  if ( index == 0 ) temp . clear ( ) ;
  for ( int i = index ;
  i < len ;
  ++ i ) {
    str = str + s . charAt ( i ) ;
    if ( checkPalindrome ( str ) ) {
      temp . add ( str ) ;
      if ( i + 1 < len ) {
        v = addStrings ( v , s , temp , i + 1 ) ;
      }
      else {
        v . add ( temp ) ;
      }
      temp = new ArrayList < > ( current ) ;
    }
  }
  return v ;
}

static ArrayList < ArrayList < String > > addStrings ( ArrayList < ArrayList < String > > v , String s , ArrayList < String > temp , int index ) { int len = s . length ( ) ; String str = " " ; ArrayList < String > current = new ArrayList < > ( temp ) ; if ( index == 0 ) temp . clear ( ) ; for ( int i = index ; i < len ; ++ i ) { str = str + s . charAt ( i ) ; if ( checkPalindrome ( str ) ) { temp . add ( str ) ; if ( i + 1 < len ) { v = addStrings ( v , s , temp , i + 1 ) ; } else { v . add ( temp ) ; } temp = new ArrayList < > ( current ) ; } } return v ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (generic_type (type_identifier) (type_arguments (type_identifier))))) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (generic_type (type_identifier) (type_arguments (type_identifier))))) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (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)) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list (identifier))))))))) (return_statement (identifier))))