
"""simple docstring"""


lowerCAmelCase								=		[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
lowerCAmelCase								=		[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
lowerCAmelCase								=		{
    0: """Sunday""",
    1: """Monday""",
    2: """Tuesday""",
    3: """Wednesday""",
    4: """Thursday""",
    5: """Friday""",
    6: """Saturday""",
}






def   lowerCAmelCase_  (						snake_case_						:     List[Any]				,       snake_case_						:     Tuple				,       snake_case_						:     List[str]     )  ->str:
			assert len(str(snake_case_     )     ) > 2, "year should be in YYYY format"
			assert 1 <= month <= 1_2, "month should be between 1 to 12"
			assert 1 <= day <= 3_1, "day should be between 1 to 31"

			# Doomsday algorithm:
			lowerCamelCase__      :	Tuple						=year // 1_0_0
			lowerCamelCase__      :	Any						=(5 * (century % 4) + 2) % 7
			lowerCamelCase__      :	Dict						=year % 1_0_0
			lowerCamelCase__      :	Tuple						=centurian % 1_2
			lowerCamelCase__      :	Optional[Any]						=(
			    (centurian // 1_2) + centurian_m + (centurian_m // 4) + century_anchor
			) % 7
			lowerCamelCase__      :	str						=(
			    DOOMSDAY_NOT_LEAP[month - 1]
			    if (year % 4 != 0) or (centurian == 0 and (year % 4_0_0) == 0)
			    else DOOMSDAY_LEAP[month - 1]
			)
			lowerCamelCase__      :	int						=(dooms_day + day - day_anchor) % 7
			return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
							import doctest

							doctest.testmod()



'''simple docstring'''
lowerCAmelCase   : List[str]             =				2_5_6
# Modulus to hash a string
lowerCAmelCase   : Tuple             =				1_0_0_0_0_0_3




def 	_A  (       A							,A							)  ->				bool:
	lowercase						:		List[Any]   					=		len(A							)
	lowercase						:		List[Any]   					=		len(A							)
	if p_len > t_len:
		return False

	lowercase						:		List[str]   					=		0
	lowercase						:		Dict   					=		0
	lowercase						:		Any   					=		1

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




def 	_A  (       )  ->				None:
	lowercase						:		Dict   					=		"abc1abc12"
	lowercase						:		Union[str, Any]   					=		"alskfjaldsabc1abc1abc12k23adsfabcabc"
	lowercase						:		Any   					=		"alskfjaldsk23adsfabcabc"
	assert rabin_karp(A							,A							) and not rabin_karp(A							,A							)

	# Test 2)
	lowercase						:		str   					=		"ABABX"
	lowercase						:		Union[str, Any]   					=		"ABABZABABYABABX"
	assert rabin_karp(A							,A							)

	# Test 3)
	lowercase						:		str   					=		"AAAB"
	lowercase						:		List[str]   					=		"ABAAAAAB"
	assert rabin_karp(A							,A							)

	# Test 4)
	lowercase						:		List[str]   					=		"abcdabcy"
	lowercase						:		str   					=		"abcxabcdabxabcdabcdabcy"
	assert rabin_karp(A							,A							)

	# Test 5)
	lowercase						:		int   					=		"Lü"
	lowercase						:		Optional[Any]   					=		"Lüsai"
	assert rabin_karp(A							,A							)
	lowercase						:		Tuple   					=		"Lue"
	assert not rabin_karp(A							,A							)
	print("Success."							)


if __name__ == "__main__":
					test_rabin_karp()


