






'''simple docstring'''





from __future__ import annotations

def _UpperCAmelCase   (	a						:	str  ,					a						:	str ):
							snake_case__	  =       get_failure_array(a )

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

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

def _UpperCAmelCase   (	a						:	str ):
							snake_case__	  =       [0]
							snake_case__	  =       0
							snake_case__	  =       1
							while j < len(a ):
														if pattern[i] == pattern[j]:
																					i += 1
														elif i > 0:
																					snake_case__	  =       failure[i - 1]
																					continue
														j += 1
														failure.append(a )
							return failure


if __name__ == "__main__":
	# Test 1)
	a__       =     """abc1abc12"""
	a__       =     """alskfjaldsabc1abc1abc12k23adsfabcabc"""
	a__       =     """alskfjaldsk23adsfabcabc"""
	assert kmp(pattern, texta) and not kmp(pattern, texta)

	# Test 2)
	a__       =     """ABABX"""
	a__       =     """ABABZABABYABABX"""
	assert kmp(pattern, text)

	# Test 3)
	a__       =     """AAAB"""
	a__       =     """ABAAAAAB"""
	assert kmp(pattern, text)

	# Test 4)
	a__       =     """abcdabcy"""
	a__       =     """abcxabcdabxabcdabcdabcy"""
	assert kmp(pattern, text)

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








import random
from typing import Any

def _UpperCAmelCase   (	a						:	list ):
							for _ in range(len(a ) ):
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__  , snake_case__	  =       data[b], data[a]
							return data


if __name__ == "__main__":
	a__       =     [0, 1, 2, 3, 4, 5, 6, 7]
	a__       =     ["""python""", """says""", """hello""", """!"""]
	print("""Fisher-Yates Shuffle:""")
	print("""List""", integers, strings)
	print("""FY Shuffle""", fisher_yates_shuffle(integers), fisher_yates_shuffle(strings))
