

"""simple docstring"""


def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase							)       ->				List[Any]:
      SCREAMING_SNAKE_CASE__   :      Dict      		=	""
      for i in table:
            res += inp[i - 1]
      return res




def  _lowercase					(    __lowerCAmelCase							)       ->				int:
      return data[1:] + data[0]




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase							)       ->				Union[str, Any]:
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	""
      for i in range(len(__snake_case							)							):
            if a[i] == b[i]:
                  res += "0"
            else:
                  res += "1"
      return res




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase							)       ->				Union[str, Any]:
      SCREAMING_SNAKE_CASE__   :      int      		=	int("""0b""" + data[0] + data[-1]  ,					2							)
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	int("""0b""" + data[1:3]  ,					2							)
      return bin(s[row][col]							)[2:]




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)       ->				List[str]:
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	message[:4]
      SCREAMING_SNAKE_CASE__   :      int      		=	message[4:]
      SCREAMING_SNAKE_CASE__   :      int      		=	apply_table(__snake_case  ,					__snake_case							)
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	xor(__snake_case  ,					__snake_case							)
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	apply_sbox(__snake_case  ,					temp[:4]							)  # noqa: E741
      SCREAMING_SNAKE_CASE__   :      List[str]      		=	apply_sbox(__snake_case  ,					temp[4:]							)
      SCREAMING_SNAKE_CASE__   :      int      		=	"0" * (2 - len(__snake_case							)) + l  # noqa: E741
      SCREAMING_SNAKE_CASE__   :      int      		=	"0" * (2 - len(__snake_case							)) + r
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	apply_table(l + r  ,					__snake_case							)
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	xor(__snake_case  ,					__snake_case							)
      return temp + right


if __name__ == "__main__":
  a					:Dict    = input("Enter 10 bit key: ")
  a					:Tuple    = input("Enter 8 bit message: ")

  a					:Any    = [6, 3, 7, 4, 8, 5, 10, 9]
  a					:List[str]    = [3, 5, 2, 7, 4, 10, 1, 9, 8, 6]
  a					:Tuple    = [2, 4, 3, 1]
  a					:List[Any]    = [2, 6, 3, 1, 4, 8, 5, 7]
  a					:Optional[Any]    = [4, 1, 3, 5, 7, 2, 8, 6]
  a					:Optional[int]    = [4, 1, 2, 3, 2, 3, 4, 1]
  a					:List[Any]    = [[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
  a					:Union[str, Any]    = [[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

  # key generation
  a					:int    = apply_table(key, paa_table)
  a					:Dict    = temp[:5]
  a					:Optional[int]    = temp[5:]
  a					:Optional[int]    = left_shift(left)
  a					:Union[str, Any]    = left_shift(right)
  a					:int    = apply_table(left + right, pa_table)
  a					:Tuple    = left_shift(left)
  a					:Union[str, Any]    = left_shift(right)
  a					:Dict    = left_shift(left)
  a					:Optional[Any]    = left_shift(right)
  a					:Optional[int]    = apply_table(left + right, pa_table)

  # encryption
  a					:Tuple    = apply_table(message, IP)
  a					:Tuple    = function(expansion, sa, sa, keya, temp)
  a					:List[Any]    = temp[4:] + temp[:4]
  a					:int    = function(expansion, sa, sa, keya, temp)
  a					:Union[str, Any]    = apply_table(temp, IP_inv)
  print("Cipher text is:", CT)

  # decryption
  a					:List[Any]    = apply_table(CT, IP)
  a					:List[Any]    = function(expansion, sa, sa, keya, temp)
  a					:int    = temp[4:] + temp[:4]
  a					:Union[str, Any]    = function(expansion, sa, sa, keya, temp)
  a					:Union[str, Any]    = apply_table(temp, IP_inv)
  print("Plain text after decypting is:", PT)







"""simple docstring"""


def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase							)       ->				bool:
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	len(__lowerCAmelCase							) + 1
      SCREAMING_SNAKE_CASE__   :      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.
      SCREAMING_SNAKE_CASE__   :      Dict      		=	[[0 for i in range(__lowerCAmelCase							)] for j in range(__lowerCAmelCase							)]

      # since string of zero length match pattern of zero length
      SCREAMING_SNAKE_CASE__   :      Dict      		=	1

      # since pattern of zero length will never match with string of non-zero length
      for i in range(1  ,					__lowerCAmelCase							):
            SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	0

      # since string of zero length will match with pattern where there
      # is at least one * alternatively
      for j in range(1  ,					__lowerCAmelCase							):
            SCREAMING_SNAKE_CASE__   :      int      		=	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] == ".":
                        SCREAMING_SNAKE_CASE__   :      Any      		=	dp[i - 1][j - 1]

                  elif pattern[j - 1] == "*":
                        if dp[i][j - 2] == 1:
                              SCREAMING_SNAKE_CASE__   :      List[str]      		=	1
                        elif pattern[j - 2] in (input_string[i - 1], "."):
                              SCREAMING_SNAKE_CASE__   :      List[Any]      		=	dp[i - 1][j]
                        else:
                              SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	0
                  else:
                        SCREAMING_SNAKE_CASE__   :      Dict      		=	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 :")

  a					:Any    = "aab"
  a					:Optional[Any]    = "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}')




