"""simple docstring"""
lowercase__					       =	256
# Modulus to hash a string
lowercase__					       =	1000003







def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->bool:
  a__:     str										=	len(_SCREAMING_SNAKE_CASE   )
  a__:     Dict										=	len(_SCREAMING_SNAKE_CASE   )
  if p_len > t_len:
    return False

  a__:     List[str]										=	0
  a__:     List[Any]										=	0
  a__:     int										=	1

  # Calculating the hash of pattern and substring of text
  for i in range(_SCREAMING_SNAKE_CASE   ):
    a__:     List[str]										=	(ord(pattern[i]   ) + p_hash * alphabet_size) % modulus
    a__:     int										=	(ord(text[i]   ) + text_hash * alphabet_size) % modulus
    if i == p_len - 1:
      continue
    a__:     Optional[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
    a__:     Any										=	(
        (text_hash - ord(text[i]   ) * modulus_power) * alphabet_size
        + ord(text[i + p_len]   )
    ) % modulus
  return False







def 						__a   (	)	->None:
  a__:     Optional[int]										=	'abc1abc12'
  a__:     Optional[int]										=	'alskfjaldsabc1abc1abc12k23adsfabcabc'
  a__:     Tuple										=	'alskfjaldsk23adsfabcabc'
  assert rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   ) and not rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )

  # Test 2)
  a__:     Dict										=	'ABABX'
  a__:     int										=	'ABABZABABYABABX'
  assert rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )

  # Test 3)
  a__:     str										=	'AAAB'
  a__:     Tuple										=	'ABAAAAAB'
  assert rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )

  # Test 4)
  a__:     Dict										=	'abcdabcy'
  a__:     Any										=	'abcxabcdabxabcdabcdabcy'
  assert rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )

  # Test 5)
  a__:     int										=	'Lü'
  a__:     Dict										=	'Lüsai'
  assert rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )
  a__:     Any										=	'Lue'
  assert not rabin_karp(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )
  print('Success.'   )


if __name__ == "__main__":
 test_rabin_karp()



"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import _LazyModule


lowercase__					       =	{'processing_wav2vec2_with_lm': ['Wav2Vec2ProcessorWithLM']}


if TYPE_CHECKING:
 from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
 import sys

 lowercase__					       =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


