




"""simple docstring"""


from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
_A													=      1_0



def 	lowercase_				(			__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)						->    int:
      for i in range(__UpperCAmelCase    ,		__UpperCAmelCase				):
            if array[i] == target:
                  return i
      return -1



def 	lowercase_				(			__UpperCAmelCase    ,		__UpperCAmelCase				)						->    int:
      lowerCAmelCase__      :			Optional[Any]   =	0
      lowerCAmelCase__      :			Union[str, Any]   =	len(__UpperCAmelCase				)
      while left <= right:
            if right - left < precision:
                  return lin_search(__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)

            lowerCAmelCase__      :			int   =	(left + right) // 3 + 1
            lowerCAmelCase__      :			Tuple   =	2 * (left + right) // 3 + 1

            if array[one_third] == target:
                  return one_third
            elif array[two_third] == target:
                  return two_third

            elif target < array[one_third]:
                  lowerCAmelCase__      :			Optional[int]   =	one_third - 1
            elif array[two_third] < target:
                  lowerCAmelCase__      :			str   =	two_third + 1

            else:
                  lowerCAmelCase__      :			Optional[int]   =	one_third + 1
                  lowerCAmelCase__      :			Optional[Any]   =	two_third - 1
      else:
            return -1



def 	lowercase_				(			__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)						->    int:
      if left < right:
            if right - left < precision:
                  return lin_search(__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)
            lowerCAmelCase__      :			List[Any]   =	(left + right) // 3 + 1
            lowerCAmelCase__      :			Tuple   =	2 * (left + right) // 3 + 1

            if array[one_third] == target:
                  return one_third
            elif array[two_third] == target:
                  return two_third

            elif target < array[one_third]:
                  return rec_ternary_search(__UpperCAmelCase    ,		one_third - 1    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)
            elif array[two_third] < target:
                  return rec_ternary_search(two_third + 1    ,		__UpperCAmelCase    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)
            else:
                  return rec_ternary_search(one_third + 1    ,		two_third - 1    ,		__UpperCAmelCase    ,		__UpperCAmelCase				)
      else:
            return -1


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  _A													=      input("""Enter numbers separated by comma:\n""").strip()
  _A													=      [int(item.strip()) for item in user_input.split(""",""")]
  assert collection == sorted(collection), f"List must be ordered.\n{collection}."
  _A													=      int(input("""Enter the number to be found in the list:\n""").strip())
  _A													=      ite_ternary_search(collection, target)
  _A													=      rec_ternary_search(0, len(collection) - 1, collection, target)
  if resulta != -1:
    print(f"""Iterative search: {target} found at positions: {resulta}""")
    print(f"""Recursive search: {target} found at positions: {resulta}""")
  else:
    print("""Not found""")











"""simple docstring"""


def 	lowercase_				(			__UpperCAmelCase				)						->    str:
      if not all(char in """01""" for char in bin_string				):
            raise ValueError("""Non-binary value was passed to the function"""				)
      if not bin_string:
            raise ValueError("""Empty string was passed to the function"""				)
      lowerCAmelCase__      :			List[str]   =	""""""
      while len(__UpperCAmelCase				) % 3 != 0:
            lowerCAmelCase__      :			Optional[Any]   =	"""0""" + bin_string
      lowerCAmelCase__      :			List[Any]   =	[
          bin_string[index : index + 3]
          for index in range(len(__UpperCAmelCase				)				)
          if index % 3 == 0
      ]
      for bin_group in bin_string_in_3_list:
            lowerCAmelCase__      :			Optional[int]   =	0
            for index, val in enumerate(__UpperCAmelCase				):
                  oct_val += int(2 ** (2 - index) * int(__UpperCAmelCase				)				)
            oct_string += str(__UpperCAmelCase				)
      return oct_string


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

  testmod()





