





'''simple docstring'''




def _lowerCAmelCase     (      _lowerCAmelCase       ,    _lowerCAmelCase    )->     str:
 __UpperCAmelCase					=   ''
 for i in table:
  res += inp[i - 1]
 return res







def _lowerCAmelCase     (      _lowerCAmelCase    )->     str:
 return data[1:] + data[0]







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







def _lowerCAmelCase     (      _lowerCAmelCase       ,    _lowerCAmelCase    )->     Optional[int]:
 __UpperCAmelCase					=   int('0b' + data[0] + data[-1]       ,    2    )
 __UpperCAmelCase					=   int('0b' + data[1:3]       ,    2    )
 return bin(s[row][col]    )[2:]







def _lowerCAmelCase     (      _lowerCAmelCase       ,    _lowerCAmelCase       ,    _lowerCAmelCase       ,    _lowerCAmelCase       ,    _lowerCAmelCase    )->     List[Any]:
 __UpperCAmelCase					=   message[:4]
 __UpperCAmelCase					=   message[4:]
 __UpperCAmelCase					=   apply_table(_lowerCAmelCase       ,    _lowerCAmelCase    )
 __UpperCAmelCase					=   xor(_lowerCAmelCase       ,    _lowerCAmelCase    )
 __UpperCAmelCase					=   apply_sbox(_lowerCAmelCase       ,    temp[:4]    )  # noqa: E741
 __UpperCAmelCase					=   apply_sbox(_lowerCAmelCase       ,    temp[4:]    )
 __UpperCAmelCase					=   '0' * (2 - len(_lowerCAmelCase    )) + l  # noqa: E741
 __UpperCAmelCase					=   '0' * (2 - len(_lowerCAmelCase    )) + r
 __UpperCAmelCase					=   apply_table(l + r       ,    _lowerCAmelCase    )
 __UpperCAmelCase					=   xor(_lowerCAmelCase       ,    _lowerCAmelCase    )
 return temp + right


if __name__ == "__main__":
    _A:					Tuple							=				input("""Enter 10 bit key: """)
    _A:					Optional[Any]							=				input("""Enter 8 bit message: """)

    _A:					Union[str, Any]							=				[6, 3, 7, 4, 8, 5, 10, 9]
    _A:					int							=				[3, 5, 2, 7, 4, 10, 1, 9, 8, 6]
    _A:					Optional[Any]							=				[2, 4, 3, 1]
    _A:					str							=				[2, 6, 3, 1, 4, 8, 5, 7]
    _A:					List[Any]							=				[4, 1, 3, 5, 7, 2, 8, 6]
    _A:					Dict							=				[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:					Optional[Any]							=				apply_table(key, paa_table)
    _A:					str							=				temp[:5]
    _A:					Optional[int]							=				temp[5:]
    _A:					Any							=				left_shift(left)
    _A:					Dict							=				left_shift(right)
    _A:					Any							=				apply_table(left + right, pa_table)
    _A:					Optional[Any]							=				left_shift(left)
    _A:					List[Any]							=				left_shift(right)
    _A:					Any							=				left_shift(left)
    _A:					int							=				left_shift(right)
    _A:					List[Any]							=				apply_table(left + right, pa_table)

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

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












'''simple docstring'''




from __future__ import annotations







def _lowerCAmelCase     (      _lowerCAmelCase    )->     int:
 if not nums:
  return 0
 __UpperCAmelCase					=   nums[0]
 __UpperCAmelCase					=   0
 for num in nums[1:]:
  __UpperCAmelCase					,    __UpperCAmelCase					=   (
      max_excluding + num,
      max(_lowerCAmelCase       ,    _lowerCAmelCase    ),
  )
 return max(_lowerCAmelCase       ,    _lowerCAmelCase    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()





