import functools
from typing import Any





def 		__lowerCamelCase							(UpperCAmelCase__       :							str ,	UpperCAmelCase__       :							list[str]					):

					# Validation
					if not isinstance(UpperCAmelCase__ ,	UpperCAmelCase__					) or len(UpperCAmelCase__					) == 0:
										raise ValueError("the string should be not empty string"					)

					if not isinstance(UpperCAmelCase__ ,	UpperCAmelCase__					) or not all(
					    isinstance(UpperCAmelCase__ ,	UpperCAmelCase__					) and len(UpperCAmelCase__					) > 0 for item in words					):
										raise ValueError("the words should be a list of non-empty strings"					)

					# Build trie
					SCREAMING_SNAKE_CASE           =    {}
					SCREAMING_SNAKE_CASE           =    "WORD_KEEPER"

					for word in words:
										SCREAMING_SNAKE_CASE           =    trie
										for c in word:
															if c not in trie_node:
																				SCREAMING_SNAKE_CASE           =    {}

															SCREAMING_SNAKE_CASE           =    trie_node[c]

										SCREAMING_SNAKE_CASE           =    True

					SCREAMING_SNAKE_CASE           =    len(UpperCAmelCase__					)

					# Dynamic programming method
					@functools.cache
					def is_breakable(UpperCAmelCase__       :							int					) -> bool:
										if index == len_string:
															return True

										SCREAMING_SNAKE_CASE           =    trie
										for i in range(UpperCAmelCase__ ,	UpperCAmelCase__					):
															SCREAMING_SNAKE_CASE           =    trie_node.get(string[i] ,	UpperCAmelCase__					)

															if trie_node is None:
																				return False

															if trie_node.get(UpperCAmelCase__ ,	UpperCAmelCase__					) and is_breakable(i + 1					):
																				return True

										return False

					return is_breakable(0					)


if __name__ == "__main__":
					import doctest

					doctest.testmod()





def 		__lowerCamelCase							(UpperCAmelCase__       :							str ,	UpperCAmelCase__       :							str = " "					):
					SCREAMING_SNAKE_CASE           =    []

					SCREAMING_SNAKE_CASE           =    0
					for index, char in enumerate(UpperCAmelCase__					):
										if char == separator:
															split_words.append(string[last_index:index]					)
															SCREAMING_SNAKE_CASE           =    index + 1
										elif index + 1 == len(UpperCAmelCase__					):
															split_words.append(string[last_index : index + 1]					)
					return split_words


if __name__ == "__main__":
							from doctest import testmod

							testmod()




