

a		=256
# Modulus to hash a string
a		=1000003






def    SCREAMING_SNAKE_CASE__       (  lowerCamelCase__	, lowerCamelCase__			)  ->     List[str]:
	__lowerCamelCase				:				str					       = len(SCREAMING_SNAKE_CASE__			)
	__lowerCamelCase				:				Optional[Any]					       = len(SCREAMING_SNAKE_CASE__			)
	if p_len > t_len:
		return False

	__lowerCamelCase				:				Union[str, Any]					       = 0
	__lowerCamelCase				:				Union[str, Any]					       = 0
	__lowerCamelCase				:				Union[str, Any]					       = 1

	# Calculating the hash of pattern and substring of text
	for i in range(SCREAMING_SNAKE_CASE__			):
		__lowerCamelCase				:				str					       = (ord(pattern[i]			) + p_hash * alphabet_size) % modulus
		__lowerCamelCase				:				str					       = (ord(text[i]			) + text_hash * alphabet_size) % modulus
		if i == p_len - 1:
			continue
		__lowerCamelCase				:				Any					       = (modulus_power * alphabet_size) % modulus

	for i in range(0	, t_len - p_len + 1			):
		if text_hash == p_hash and text[i : i + p_len] == pattern:
			return True
		if i == t_len - p_len:
			continue
		# Calculate the https://en.wikipedia.org/wiki/Rolling_hash
		__lowerCamelCase				:				int					       = (
		    (text_hash - ord(text[i]			) * modulus_power) * alphabet_size
		    + ord(text[i + p_len]			)
		) % modulus
	return False






def    SCREAMING_SNAKE_CASE__       (  )  ->     List[str]:
	__lowerCamelCase				:				Union[str, Any]					       = 'abc1abc12'
	__lowerCamelCase				:				int					       = 'alskfjaldsabc1abc1abc12k23adsfabcabc'
	__lowerCamelCase				:				Tuple					       = 'alskfjaldsk23adsfabcabc'
	assert rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			) and not rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)

	# Test 2)
	__lowerCamelCase				:				Any					       = 'ABABX'
	__lowerCamelCase				:				List[str]					       = 'ABABZABABYABABX'
	assert rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)

	# Test 3)
	__lowerCamelCase				:				Tuple					       = 'AAAB'
	__lowerCamelCase				:				Dict					       = 'ABAAAAAB'
	assert rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)

	# Test 4)
	__lowerCamelCase				:				Optional[int]					       = 'abcdabcy'
	__lowerCamelCase				:				Union[str, Any]					       = 'abcxabcdabxabcdabcdabcy'
	assert rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)

	# Test 5)
	__lowerCamelCase				:				str					       = 'Lü'
	__lowerCamelCase				:				Dict					       = 'Lüsai'
	assert rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)
	__lowerCamelCase				:				List[Any]					       = 'Lue'
	assert not rabin_karp(SCREAMING_SNAKE_CASE__	, SCREAMING_SNAKE_CASE__			)
	print('Success.'			)


if __name__ == "__main__":
					test_rabin_karp()







from ..utils import DummyObject, requires_backends





class 	snake_case_   (		metaclass=__A					):







			'''simple docstring'''

			SCREAMING_SNAKE_CASE     :   Union[str, Any]									=				["note_seq"]







			def __init__(     self :				Optional[int]							,   *_UpperCamelCase :				str							,   **_UpperCamelCase :				Optional[int]							)      ->Any:
									requires_backends(self							,   ['''note_seq''']							)







			@classmethod
			def 				snake_case__(     cls :				int							,   *_UpperCamelCase :				Any							,   **_UpperCamelCase :				List[Any]							)      ->int:
									requires_backends(cls							,   ['''note_seq''']							)







			@classmethod
			def 				snake_case__(     cls :				Dict							,   *_UpperCamelCase :				Optional[int]							,   **_UpperCamelCase :				Union[str, Any]							)      ->List[str]:
									requires_backends(cls							,   ['''note_seq''']							)