




"""simple docstring"""
import functools





def 						UpperCAmelCase				(			A__:    str							,				A__:    str     )  ->     int:
			__lowerCamelCase					:	List[Any]	       =				len(A__     )
			__lowerCamelCase					:	Dict	       =				len(A__     )

			@functools.cache
			def min_distance(A__:    int							,				A__:    int     ) -> int:
						# if first word index is overflow - delete all from the second word
						if indexa >= len_worda:
									return len_worda - indexa
						# if second word index is overflow - delete all from the first word
						if indexa >= len_worda:
									return len_worda - indexa
						__lowerCamelCase					:	Optional[Any]	       =				int(worda[indexa] != worda[indexa]     )  # current letters not identical
						return min(
						    1 + min_distance(indexa + 1							,				A__     )							,				1 + min_distance(A__							,				indexa + 1     )							,				diff + min_distance(indexa + 1							,				indexa + 1     )							,				)

			return min_distance(0							,				0     )


if __name__ == "__main__":
					import doctest

					doctest.testmod()









"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey





def 						UpperCAmelCase				(			A__:    Tuple     )  ->     Union[str, Any]:
			# getting number of pixels in the image
			__lowerCamelCase       ,      __lowerCamelCase					:	Optional[Any]	       =				img.shape[0], img.shape[1]

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

			return img


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

					# convert to its negative
					a_				:    str										=     convert_to_negative(img)

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



