



'''simple docstring'''

def 				a  (     UpperCamelCase_    :    str			)       ->	list[int]:
		snake_case__	     =[0 for i in range(len(UpperCamelCase_			)			)]

		# initialize interval's left pointer and right pointer
		snake_case__     ,	snake_case__	     =0, 0

		for i in range(1      ,					len(UpperCamelCase_			)			):
				# case when current index is inside the interval
				if i <= right_pointer:
						snake_case__	     =min(right_pointer - i + 1      ,					z_result[i - left_pointer]			)
						snake_case__	     =min_edge

				while go_next(UpperCamelCase_      ,					UpperCamelCase_      ,					UpperCamelCase_			):
						z_result[i] += 1

				# if new index's result gives us more right interval,
				# we've to update left_pointer and right_pointer
				if i + z_result[i] - 1 > right_pointer:
						snake_case__     ,	snake_case__	     =i, i + z_result[i] - 1

		return z_result






def 				a  (     UpperCamelCase_    :    int      ,					UpperCamelCase_    :    list[int]      ,					UpperCamelCase_    :    str			)       ->	bool:
		return i + z_result[i] < len(UpperCamelCase_			) and s[z_result[i]] == s[i + z_result[i]]






def 				a  (     UpperCamelCase_    :    str      ,					UpperCamelCase_    :    str			)       ->	int:
		snake_case__	     =0
		# concatenate 'pattern' and 'input_str' and call z_function
		# with concatenated string
		snake_case__	     =z_function(pattern + input_str			)

		for val in z_result:
				# if value is greater then length of the pattern string
				# that means this index is starting position of substring
				# which is equal to pattern string
				if val >= len(UpperCamelCase_			):
						answer += 1

		return answer


if __name__ == "__main__":
			import doctest

			doctest.testmod()









'''simple docstring'''

from timeit import timeit






def 				a  (     UpperCamelCase_    :    int			)       ->	int:
		if number < 0:
				raise ValueError('the value of input must not be negative'			)
		snake_case__	     =0
		while number:
				number &= number - 1
				result += 1
		return result






def 				a  (     UpperCamelCase_    :    int			)       ->	int:
		if number < 0:
				raise ValueError('the value of input must not be negative'			)
		snake_case__	     =0
		while number:
				if number % 2 == 1:
						result += 1
				number >>= 1
		return result






def 				a  (     )       ->	None:

		def do_benchmark(UpperCamelCase_    :    int			) -> None:
				snake_case__	     ='import __main__ as z'
				print(f"""Benchmark when {number = }:"""			)
				print(f"""{get_set_bits_count_using_modulo_operator(UpperCamelCase_			) = }"""			)
				snake_case__	     =timeit('z.get_set_bits_count_using_modulo_operator(25)'      ,					setup=UpperCamelCase_			)
				print(f"""timeit() runs in {timing} seconds"""			)
				print(f"""{get_set_bits_count_using_brian_kernighans_algorithm(UpperCamelCase_			) = }"""			)
				snake_case__	     =timeit(
				    'z.get_set_bits_count_using_brian_kernighans_algorithm(25)'      ,					setup=UpperCamelCase_      ,					)
				print(f"""timeit() runs in {timing} seconds"""			)

		for number in (25, 37, 58, 0):
				do_benchmark(UpperCamelCase_			)
				print()


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			benchmark()




