


"""simple docstring"""
class 	lowercase__				:  # Public class to implement a graph





   def __init__(							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  None:
      _lowerCamelCase	:					str   =		row
      _lowerCamelCase	:					Dict   =		col
      _lowerCamelCase	:					List[str]   =		graph





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  bool:
      return (
          0 <= i < self.ROW
          and 0 <= j < self.COL
          and not visited[i][j]
          and self.graph[i][j]
      )





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  None:
      # Checking all 8 elements surrounding nth element
      _lowerCamelCase	:					Optional[int]   =		[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
      _lowerCamelCase	:					Union[str, Any]   =		[-1, 0, 1, -1, 1, -1, 0, 1]
      _lowerCamelCase	:					Union[str, Any]   =		True  # Make those cells visited
      for k in range(8):
         if self.is_safe(i + row_nbr[k]      ,   j + col_nbr[k]      ,   SCREAMING_SNAKE_CASE):
            self.diffs(i + row_nbr[k]      ,   j + col_nbr[k]      ,   SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self)  ->  int:  # And finally, count all islands.
      _lowerCamelCase	:					Tuple   =		[[False for j in range(self.COL)] for i in range(self.ROW)]
      _lowerCamelCase	:					int   =		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(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)
               count += 1
      return count





"""simple docstring"""
def 				_snake_case      (   __snake_case							:      str						, __snake_case							:      str   ):




   """simple docstring"""







   _lowerCamelCase	:					str   =		len(__snake_case   )
   _lowerCamelCase	:					Union[str, Any]   =		len(__snake_case   )
   _lowerCamelCase	:					int   =		[[False for _ in range(m + 1   )] for _ in range(n + 1   )]
   _lowerCamelCase	:					Union[str, Any]   =		True
   for i in range(__snake_case   ):
      for j in range(m + 1   ):
         if dp[i][j]:
            if j < m and a[i].upper() == b[j]:
               _lowerCamelCase	:					Tuple   =		True
            if a[i].islower():
               _lowerCamelCase	:					Tuple   =		True
   return dp[n][m]


if __name__ == "__main__":
 import doctest

 doctest.testmod()

