
import functools
from typing import Any




def 							a		(				snake_case__:   str		,  snake_case__:   list[str]   ):


				'''simple docstring'''

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

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

				# Build trie
				lowercase_	    =   {}
				lowercase_	    =   '''WORD_KEEPER'''

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

												lowercase_	    =   trie_node[c]

								lowercase_	    =   True

				lowercase_	    =   len(snake_case__   )

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

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

												if trie_node is None:
																return False

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

								return False

				return is_breakable(0   )


if __name__ == "__main__":
						import doctest

						doctest.testmod()









'''simple docstring'''
from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


snake_case_					:      List[Any]    			=    {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']}


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_					:      str    			=    [
					    'VAN_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'VanForImageClassification',
					    'VanModel',
					    'VanPreTrainedModel',
					]

if TYPE_CHECKING:
					from .configuration_van import VAN_PRETRAINED_CONFIG_ARCHIVE_MAP, VanConfig

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_van import (
										    VAN_PRETRAINED_MODEL_ARCHIVE_LIST,
										    VanForImageClassification,
										    VanModel,
										    VanPreTrainedModel,
										)

else:
					import sys

					snake_case_					:      List[Any]    			=    _LazyModule(__name__, globals()['__file__'], _import_structure)


