





def 						lowerCamelCase__     (     UpperCamelCase__			:       str						)			-> list[int]:



					'''simple docstring'''




					_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 						lowerCamelCase__     (     UpperCamelCase__			:       int       ,    UpperCamelCase__			:       list[int]       ,    UpperCamelCase__			:       str						)			-> bool:



					'''simple docstring'''




					return i + z_result[i] < len(UpperCamelCase__						) and s[z_result[i]] == s[i + z_result[i]]





def 						lowerCamelCase__     (     UpperCamelCase__			:       str       ,    UpperCamelCase__			:       str						)			-> int:



					'''simple docstring'''




					_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()










from cva import destroyAllWindows, imread, imshow, waitKey





def 						lowerCamelCase__     (     UpperCamelCase__			:       Optional[int]						)			-> Optional[int]:



					'''simple docstring'''




					_snake_case							,     _snake_case									=				img.shape[0], img.shape[1]

					# converting each pixel's color to its negative
					for i in range(UpperCamelCase__						):
										for j in range(UpperCamelCase__						):
															_snake_case									=				[255, 255, 255] - img[i][j]

					return img


if __name__ == "__main__":
					# read original image
					UpperCAmelCase_      							=     imread("""image_data/lena.jpg""", 1)

					# convert to its negative
					UpperCAmelCase_      							=     convert_to_negative(img)

					# show result image
					imshow("""negative of original image""", img)
					waitKey(0)
					destroyAllWindows()



