





'''simple docstring'''


import functools
from typing import Any
def 							UpperCAmelCase_  (						__lowerCamelCase : str     ,__lowerCamelCase : list[str]			):

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

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

   # Build trie
   lowercase_      :Tuple         =			{}
   lowercase_      :Optional[int]         =			"WORD_KEEPER"

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

         lowercase_      :Any         =			trie_node[c]

      lowercase_      :Tuple         =			True

   lowercase_      :Dict         =			len(__lowerCAmelCase			)

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

      lowercase_      :Dict         =			trie
      for i in range(__lowerCAmelCase     ,__lowerCAmelCase			):
         lowercase_      :Optional[int]         =			trie_node.get(string[i]     ,__lowerCAmelCase			)

         if trie_node is None:
            return False

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

      return False

   return is_breakable(0			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()









'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase : int | float | str			):
   try:
      lowercase_      :Optional[int]         =			float(__lowerCamelCase			)
   except ValueError:
      raise ValueError("Please enter a valid number"			)
   lowercase_      :Dict         =			decimal - int(__lowerCamelCase			)
   if fractional_part == 0:
      return int(__lowerCamelCase			), 1
   else:
      lowercase_      :Tuple         =			len(str(__lowerCamelCase			).split("."			)[1]			)
      lowercase_      :Optional[Any]         =			int(decimal * (10**number_of_frac_digits)			)
      lowercase_      :Dict         =			10**number_of_frac_digits
      lowercase_      ,							lowercase_      :Optional[int]         =			denominator, numerator
      while True:
         lowercase_      :Any         =			dividend % divisor
         if remainder == 0:
            break
         lowercase_      ,							lowercase_      :Optional[int]         =			divisor, remainder
      lowercase_      ,							lowercase_      :Optional[int]         =			numerator / divisor, denominator / divisor
      return int(__lowerCamelCase			), int(__lowerCamelCase			)


if __name__ == "__main__":
 print(F'''{decimal_to_fraction(2) = }''')
 print(F'''{decimal_to_fraction(89.0) = }''')
 print(F'''{decimal_to_fraction('67') = }''')
 print(F'''{decimal_to_fraction('45.0') = }''')
 print(F'''{decimal_to_fraction(1.5) = }''')
 print(F'''{decimal_to_fraction('6.25') = }''')
 print(F'''{decimal_to_fraction('78td') = }''')


