



import functools
from typing import Any







def    _snake_case (       __snake_case					,  __snake_case    )     ->     bool:






      '''simple docstring'''







      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
      UpperCAmelCase_  :	dict[str, Any]				      =		{}
      UpperCAmelCase_  :	int				      =		"WORD_KEEPER"

      for word in words:
            UpperCAmelCase_  :	Union[str, Any]				      =		trie
            for c in word:
                  if c not in trie_node:
                        UpperCAmelCase_  :	List[Any]				      =		{}

                  UpperCAmelCase_  :	int				      =		trie_node[c]

            UpperCAmelCase_  :	Tuple				      =		True

      UpperCAmelCase_  :	Optional[Any]				      =		len(__snake_case    )

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

            UpperCAmelCase_  :	Dict				      =		trie
            for i in range(__snake_case					,  __snake_case    ):
                  UpperCAmelCase_  :	Union[str, Any]				      =		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()





def    _snake_case (       __snake_case					,  __snake_case    )     ->     int:






      '''simple docstring'''







      return int((input_a, input_a).count(0    ) != 0    )







def    _snake_case (       )     ->     None:






      '''simple docstring'''







      assert nand_gate(0					,  0    ) == 1
      assert nand_gate(0					,  1    ) == 1
      assert nand_gate(1					,  0    ) == 1
      assert nand_gate(1					,  1    ) == 0


if __name__ == "__main__":
   print(nand_gate(0, 0))
   print(nand_gate(0, 1))
   print(nand_gate(1, 0))
   print(nand_gate(1, 1))
