





'''simple docstring'''




class 					SCREAMING_SNAKE_CASE       :  # Public class to implement a graph


     def __init__(		self		,      _UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase):

          '''simple docstring'''






          __A		:					str						=			row
          __A		:					Any						=			col
          __A		:					Union[str, Any]						=			graph


     def 				SCREAMING_SNAKE_CASE    (		self		,      _UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase):

          '''simple docstring'''






          return (
              0 <= i < self.ROW
              and 0 <= j < self.COL
              and not visited[i][j]
              and self.graph[i][j]
          )


     def 				SCREAMING_SNAKE_CASE    (		self		,      _UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase):

          '''simple docstring'''






          __A		:					Union[str, Any]						=			[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
          __A		:					Dict						=			[-1, 0, 1, -1, 1, -1, 0, 1]
          __A		:					str						=			True  # Make those cells visited
          for k in range(8):
               if self.is_safe(i + row_nbr[k]		,      j + col_nbr[k]		,      _UpperCAmelCase):
                    self.diffs(i + row_nbr[k]		,      j + col_nbr[k]		,      _UpperCAmelCase)


     def 				SCREAMING_SNAKE_CASE    (		self):  # And finally, count all islands.

          '''simple docstring'''






          __A		:					Tuple						=			[[False for j in range(self.COL)] for i in range(self.ROW)]
          __A		:					Optional[Any]						=			0
          for i in range(self.ROW):
               for j in range(self.COL):
                    if visited[i][j] is False and self.graph[i][j] == 1:
                         self.diffs(_UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase)
                         count += 1
          return count
def 							UpperCAmelCase		(       lowercase				,     lowercase				):







				"""simple docstring"""



				__lowercase					     =				len(lowercase				)
				__lowercase					     =				len(lowercase				)
				__lowercase					     =				[[False for _ in range(m + 1				)] for _ in range(n + 1				)]
				__lowercase					     =				True
				for i in range(lowercase				):
								for j in range(m + 1				):
												if dp[i][j]:
																if j < m and a[i].upper() == b[j]:
																				__lowercase					     =				True
																if a[i].islower():
																				__lowercase					     =				True
				return dp[n][m]


if __name__ == "__main__":
		import doctest

		doctest.testmod()