


"""simple docstring"""


from __future__ import annotations




def   snake_case		(     UpperCamelCase__       :						Union[str, Any]			,				UpperCamelCase__       :						List[str]    )   ->      bool:
      lowerCamelCase					:					Optional[int]        =	get_failure_array(_lowerCAmelCase    )

      # 2) Step through text searching for pattern
      lowerCamelCase					:					Optional[Any]        =	0, 0  # index into text, pattern
      while i < len(_lowerCAmelCase    ):
            if pattern[j] == text[i]:
                  if j == (len(_lowerCAmelCase    ) - 1):
                        return True
                  j += 1

            # if this is a prefix in our pattern
            # just go back far enough to continue
            elif j > 0:
                  lowerCamelCase					:					str        =	failure[j - 1]
                  continue
            i += 1
      return False




def   snake_case		(     UpperCamelCase__       :						str    )   ->      list[int]:
      lowerCamelCase					:					List[Any]        =	[0]
      lowerCamelCase					:					List[Any]        =	0
      lowerCamelCase					:					Union[str, Any]        =	1
      while j < len(_lowerCAmelCase    ):
            if pattern[i] == pattern[j]:
                  i += 1
            elif i > 0:
                  lowerCamelCase					:					Optional[int]        =	failure[i - 1]
                  continue
            j += 1
            failure.append(_lowerCAmelCase    )
      return failure


if __name__ == "__main__":
    # Test 1)
    __lowerCamelCase      :Optional[Any]	    =		"""abc1abc12"""
    __lowerCamelCase      :int	    =		"""alskfjaldsabc1abc1abc12k23adsfabcabc"""
    __lowerCamelCase      :Tuple	    =		"""alskfjaldsk23adsfabcabc"""
    assert kmp(pattern, texta) and not kmp(pattern, texta)

    # Test 2)
    __lowerCamelCase      :List[Any]	    =		"""ABABX"""
    __lowerCamelCase      :Dict	    =		"""ABABZABABYABABX"""
    assert kmp(pattern, text)

    # Test 3)
    __lowerCamelCase      :Optional[int]	    =		"""AAAB"""
    __lowerCamelCase      :Any	    =		"""ABAAAAAB"""
    assert kmp(pattern, text)

    # Test 4)
    __lowerCamelCase      :Optional[Any]	    =		"""abcdabcy"""
    __lowerCamelCase      :Optional[Any]	    =		"""abcxabcdabxabcdabcdabcy"""
    assert kmp(pattern, text)

    # Test 5)
    __lowerCamelCase      :str	    =		"""aabaabaaa"""
    assert get_failure_array(pattern) == [0, 1, 0, 1, 2, 3, 4, 5, 2]










"""simple docstring"""


from __future__ import annotations

import math




def   snake_case		(     UpperCamelCase__       :						float			,				UpperCamelCase__       :						int    )   ->      float:
      lowerCamelCase					:					Dict        =	u
      for i in range(1			,				UpperCamelCase__    ):
            lowerCamelCase					:					List[str]        =	temp * (u - i)
      return temp




def   snake_case		(     )   ->      None:
      lowerCamelCase					:					List[Any]        =	int(input("""enter the numbers of values: """    )    )
      lowerCamelCase					:					list[list[float]]        =	[]
      for _ in range(UpperCamelCase__    ):
            y.append([]    )
      for i in range(UpperCamelCase__    ):
            for j in range(UpperCamelCase__    ):
                  y[i].append(UpperCamelCase__    )
                  lowerCamelCase					:					Union[str, Any]        =	0

      print("""enter the values of parameters in a list: """    )
      lowerCamelCase					:					Any        =	list(map(UpperCamelCase__			,				input().split()    )    )

      print("""enter the values of corresponding parameters: """    )
      for i in range(UpperCamelCase__    ):
            lowerCamelCase					:					int        =	float(input()    )

      lowerCamelCase					:					Dict        =	int(input("""enter the value to interpolate: """    )    )
      lowerCamelCase					:					List[Any]        =	(value - x[0]) / (x[1] - x[0])

      # for calculating forward difference table

      for i in range(1			,				UpperCamelCase__    ):
            for j in range(n - i    ):
                  lowerCamelCase					:					str        =	y[j + 1][i - 1] - y[j][i - 1]

      lowerCamelCase					:					Any        =	y[0][0]
      for i in range(1			,				UpperCamelCase__    ):
            summ += (ucal(UpperCamelCase__			,				UpperCamelCase__    ) * y[0][i]) / math.factorial(UpperCamelCase__    )

      print(F'the value at {value} is {summ}'    )


if __name__ == "__main__":
    main()




