



from __future__ import annotations



def 		lowerCAmelCase__    (					UpperCamelCase_				:       Tuple	)->  List[Any]:


    if not nums:
        return 0
    A__		 =					nums[0]
    A__		 =					0
    for num in nums[1:]:
        A__		 =					(
            max_excluding + num,
            max(lowerCamelCase__ ,       lowerCamelCase__	),
        )
    return max(lowerCamelCase__ ,       lowerCamelCase__	)


if __name__ == "__main__":
   import doctest

   doctest.testmod()








from __future__ import annotations



def 		lowerCAmelCase__    (					UpperCamelCase_				:       str ,       UpperCamelCase_				:       list[str] | None = None	)->  list[list[str]]:
    A__		 =					word_bank or []
    # create a table
    A__		 =					len(UpperCamelCase_	) + 1

    A__		 =					[]
    for _ in range(UpperCamelCase_	):
        table.append([]	)
    # seed value
    A__		 =					[[]]  # because empty string has empty combination

    # iterate through the indices
    for i in range(UpperCamelCase_	):
        # condition
        if table[i] != []:
            for word in word_bank:
                # slice condition
                if target[i : i + len(UpperCamelCase_	)] == word:
                    A__		 =					[
                        [word, *way] for way in table[i]
                    ]
                    # adds the word to every combination the current position holds
                    # now,push that combination to the table[i+len(word)]
                    table[i + len(UpperCamelCase_	)] += new_combinations

    # combinations are in reverse order so reverse for better output
    for combination in table[len(UpperCamelCase_	)]:
        combination.reverse()

    return table[len(UpperCamelCase_	)]


if __name__ == "__main__":
   print(all_construct("jwajalapa", ["jwa", "j", "w", "a", "la", "lapa"]))
   print(all_construct("rajamati", ["s", "raj", "amat", "raja", "ma", "i", "t"]))
   print(
       all_construct(
           "hexagonosaurus",
           ["h", "ex", "hex", "ag", "ago", "ru", "auru", "rus", "go", "no", "o", "s"],
       )
   )
