
def    __UpperCamelCase     (				lowerCAmelCase__							:				str  ,   lowerCAmelCase__							:				str  ):
 __a :  Union[str, Any]						=  len(lowerCAmelCase__  ) + 1
 __a :  Optional[int]						=  len(lowerCAmelCase__  ) + 1

 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of
 # length i of input_string matches with prefix string of length j of
 # given pattern.
 # "dp" stands for dynamic programming.
 __a :  List[Any]						=  [[0 for i in range(lowerCAmelCase__  )] for j in range(lowerCAmelCase__  )]

 # since string of zero length match pattern of zero length
 __a :  List[Any]						=  1

 # since pattern of zero length will never match with string of non-zero length
 for i in range(1  ,   lowerCAmelCase__  ):
  __a :  int						=  0

 # since string of zero length will match with pattern where there
 # is at least one * alternatively
 for j in range(1  ,   lowerCAmelCase__  ):
  __a :  List[Any]						=  dp[0][j - 2] if pattern[j - 1] == '''*''' else 0

 # now using bottom-up approach to find for all remaining lengths
 for i in range(1  ,   lowerCAmelCase__  ):
  for j in range(1  ,   lowerCAmelCase__  ):
   if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
    __a :  Dict						=  dp[i - 1][j - 1]

   elif pattern[j - 1] == "*":
    if dp[i][j - 2] == 1:
     __a :  Tuple						=  1
    elif pattern[j - 2] in (input_string[i - 1], "."):
     __a :  int						=  dp[i - 1][j]
    else:
     __a :  Dict						=  0
   else:
    __a :  List[Any]						=  0

 return bool(dp[-1][-1]  )


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      # inputing the strings
      # input_string = input("input a string :")
      # pattern = input("input a pattern :")

      lowercase__       ='aab'
      lowercase__       ='c*a*b'

      # using function to check whether given string matches the given pattern
      if match_pattern(input_string, pattern):
            print(F"""{input_string} matches the given pattern {pattern}""")
      else:
            print(F"""{input_string} does not match with the given pattern {pattern}""")


import colorsys

from PIL import Image  # type: ignore




def    __UpperCamelCase     (				lowerCAmelCase__							:				float  ,   lowerCAmelCase__							:				float  ,   lowerCAmelCase__							:				int  ):
 __a :  Any						=  x
 __a :  List[Any]						=  y
 for step in range(lowerCAmelCase__  ):  # noqa: B007
  __a :  List[Any]						=  a * a - b * b + x
  __a :  Tuple						=  2 * a * b + y
  __a :  Optional[int]						=  a_new

  # divergence happens for all complex number with an absolute value
  # greater than 4
  if a * a + b * b > 4:
   break
 return step / (max_step - 1)




def    __UpperCamelCase     (				lowerCAmelCase__							:				float  ):
 if distance == 1:
  return (0, 0, 0)
 else:
  return (2_5_5, 2_5_5, 2_5_5)




def    __UpperCamelCase     (				lowerCAmelCase__							:				float  ):
 if distance == 1:
  return (0, 0, 0)
 else:
  return tuple(round(i * 2_5_5  ) for i in colorsys.hsv_to_rgb(lowerCAmelCase__  ,   1  ,   1  )  )




def    __UpperCamelCase     (				lowerCAmelCase__							:				int = 8_0_0  ,   lowerCAmelCase__							:				int = 6_0_0  ,   lowerCAmelCase__							:				float = -0.6  ,   lowerCAmelCase__							:				float = 0  ,   lowerCAmelCase__							:				float = 3.2  ,   lowerCAmelCase__							:				int = 5_0  ,   lowerCAmelCase__							:				bool = True  ,   ):
 __a :  int						=  Image.new('''RGB'''  ,   (image_width, image_height)  )
 __a :  Dict						=  img.load()

 # loop through the image-coordinates
 for image_x in range(lowerCAmelCase__  ):
  for image_y in range(lowerCAmelCase__  ):
   # determine the figure-coordinates based on the image-coordinates
   __a :  Optional[Any]						=  figure_width / image_width * image_height
   __a :  str						=  figure_center_x + (image_x / image_width - 0.5) * figure_width
   __a :  str						=  figure_center_y + (image_y / image_height - 0.5) * figure_height

   __a :  Tuple						=  get_distance(lowerCAmelCase__  ,   lowerCAmelCase__  ,   lowerCAmelCase__  )

   # color the corresponding pixel based on the selected coloring-function
   if use_distance_color_coding:
    __a :  Optional[int]						=  get_color_coded_rgb(lowerCAmelCase__  )
   else:
    __a :  Optional[Any]						=  get_black_and_white_rgb(lowerCAmelCase__  )

 return img


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      # colored version, full figure
      lowercase__       =get_image()

      # uncomment for colored version, different section, zoomed in
      # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
      # figure_width = 0.8)

      # uncomment for black and white version, full figure
      # img = get_image(use_distance_color_coding = False)

      # uncomment to save the image
      # img.save("mandelbrot.png")

      img.show()
