

def 						lowerCamelCase__      ( __A    :str	,__A    :str		):


       """simple docstring"""




       if not (isinstance(__A	,__A		) and isinstance(__A	,__A		)):
              raise ValueError("""longest_common_substring() takes two strings for inputs"""		)

       __snake_case       	=							len(__A		)
       __snake_case       	=							len(__A		)

       __snake_case       	=							[[0] * (texta_length + 1) for _ in range(texta_length + 1		)]
       __snake_case       	=							0
       __snake_case       	=							0

       for i in range(1	,texta_length + 1		):
              for j in range(1	,texta_length + 1		):
                     if texta[i - 1] == texta[j - 1]:
                            __snake_case       	=							1 + dp[i - 1][j - 1]
                            if dp[i][j] > ans_length:
                                   __snake_case       	=							i
                                   __snake_case       	=							dp[i][j]

       return texta[ans_index - ans_length : ans_index]


if __name__ == "__main__":
    import doctest

    doctest.testmod()




from PIL import Image







def 						lowerCamelCase__      ( __A    :Image		):


       """simple docstring"""




       __snake_case	,    __snake_case       	=							image.size
       __snake_case       	=							0
       __snake_case       	=							image.load()
       for i in range(__A		):
              for j in range(__A		):
                     __snake_case       	=							pixels[j, i]
                     mean += pixel
       mean //= width * height

       for j in range(__A		):
              for i in range(__A		):
                     __snake_case       	=							2_5_5 if pixels[i, j] > mean else 0
       return image


if __name__ == "__main__":
    UpperCamelCase__		 =     mean_threshold(Image.open('''path_to_image''').convert('''L'''))
    image.save('''output_image_path''')

