



"""simple docstring"""







import math

def     UpperCamelCase_   (   )						->       None:

  """simple docstring"""




  lowerCAmelCase_       :    List[Any]								=			input('Enter message: '						)
  lowerCAmelCase_       :    Any								=			int(input(f"Enter key [2-{len(lowerCAmelCase__						) - 1}]: "						)						)
  lowerCAmelCase_       :    Union[str, Any]								=			input('Encryption/Decryption [e/d]: '						)

  if mode.lower().startswith('e'						):
    lowerCAmelCase_       :    List[str]								=			encrypt_message(lowerCAmelCase__   ,       lowerCAmelCase__						)
  elif mode.lower().startswith('d'						):
    lowerCAmelCase_       :    List[Any]								=			decrypt_message(lowerCAmelCase__   ,       lowerCAmelCase__						)

  # Append pipe symbol (vertical bar) to identify spaces at the end.
  print(f"Output:\n{text + '|'}"						)

def     UpperCamelCase_   (   lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    str						)						->       str:

  """simple docstring"""




  lowerCAmelCase_       :    List[Any]								=			[''] * key
  for col in range(lowerCAmelCase__						):
    lowerCAmelCase_       :    Tuple								=			col
    while pointer < len(lowerCAmelCase__						):
      cipher_text[col] += message[pointer]
      pointer += key
  return "".join(lowerCAmelCase__						)

def     UpperCamelCase_   (   lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    str						)						->       str:

  """simple docstring"""




  lowerCAmelCase_       :    Tuple								=			math.ceil(len(lowerCAmelCase__						) / key						)
  lowerCAmelCase_       :    Dict								=			key
  lowerCAmelCase_       :    int								=			(num_cols * num_rows) - len(lowerCAmelCase__						)
  lowerCAmelCase_       :    Optional[Any]								=			[''] * num_cols
  lowerCAmelCase_       :    int								=			0
  lowerCAmelCase_       :    Dict								=			0

  for symbol in message:
    plain_text[col] += symbol
    col += 1

    if (
        (col == num_cols)
        or (col == num_cols - 1)
        and (row >= num_rows - num_shaded_boxes)
    ):
      lowerCAmelCase_       :    List[str]								=			0
      row += 1

  return "".join(lowerCAmelCase__						)


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()










"""simple docstring"""







from collections.abc import Iterable
from typing import Generic, TypeVar

lowercase__		:    Any				   =     TypeVar("""_T""")







class 				UpperCamelCase__       (     Generic[_T]  ):




      """simple docstring"""




      def __init__(				self    :				Any   ,      SCREAMING_SNAKE_CASE_    :				Iterable[_T] | None = None	):
        lowerCAmelCase_       :    list[_T]								=			list(iterable or []	)
        lowerCAmelCase_       :    list[_T]								=			[]



      def __len__(				self    :				List[str]	):
        return len(self._stacka	) + len(self._stacka	)



      def __repr__(				self    :				int	):
        return F"Queue({tuple(self._stacka[::-1] + self._stacka	)})"



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				_T	):
        self._stacka.append(SCREAMING_SNAKE_CASE_	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				str	):
        lowerCAmelCase_       :    List[str]								=			self._stacka.pop
        lowerCAmelCase_       :    int								=			self._stacka.append

        if not self._stacka:
          while self._stacka:
            stacka_append(stacka_pop()	)

        if not self._stacka:
          raise IndexError('Queue is empty'	)
        return self._stacka.pop()


if __name__ == "__main__":
     from doctest import testmod

     testmod()





