




import math

def    UpperCAmelCase_				( )   ->					None:
      SCREAMING_SNAKE_CASE_      		=     input('Enter message: '				)
      SCREAMING_SNAKE_CASE_      		=     int(input(f"Enter key [2-{len(__UpperCAmelCase				) - 1}]: "				)				)
      SCREAMING_SNAKE_CASE_      		=     input('Encryption/Decryption [e/d]: '				)

      if mode.lower().startswith('e'				):
            SCREAMING_SNAKE_CASE_      		=     encrypt_message(__UpperCAmelCase     ,     __UpperCAmelCase				)
      elif mode.lower().startswith('d'				):
            SCREAMING_SNAKE_CASE_      		=     decrypt_message(__UpperCAmelCase     ,     __UpperCAmelCase				)

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

def    UpperCAmelCase_				( __UpperCAmelCase		:      int     ,     __UpperCAmelCase		:      str				)   ->					str:
      SCREAMING_SNAKE_CASE_      		=     [''] * key
      for col in range(__UpperCAmelCase				):
            SCREAMING_SNAKE_CASE_      		=     col
            while pointer < len(__UpperCAmelCase				):
                  cipher_text[col] += message[pointer]
                  pointer += key
      return "".join(__UpperCAmelCase				)

def    UpperCAmelCase_				( __UpperCAmelCase		:      int     ,     __UpperCAmelCase		:      str				)   ->					str:
      SCREAMING_SNAKE_CASE_      		=     math.ceil(len(__UpperCAmelCase				) / key				)
      SCREAMING_SNAKE_CASE_      		=     key
      SCREAMING_SNAKE_CASE_      		=     (num_cols * num_rows) - len(__UpperCAmelCase				)
      SCREAMING_SNAKE_CASE_      		=     [''] * num_cols
      SCREAMING_SNAKE_CASE_      		=     0
      SCREAMING_SNAKE_CASE_      		=     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)
            ):
                  SCREAMING_SNAKE_CASE_      		=     0
                  row += 1

      return "".join(__UpperCAmelCase				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   main()

from __future__ import annotations

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

__magic_name__  							=	TypeVar('''T''')




class        _SCREAMING_SNAKE_CASE	(   Generic[T]			):
      def __init__(      self		,						lowerCamelCase			):
          snake_case__    =					data
          snake_case__    =					None



      def __str__(      self			):
          return F"""{self.data}"""





class        _SCREAMING_SNAKE_CASE	(   Generic[T]			):
      def __init__(      self			):
          snake_case__    =					None
      def __iter__(      self			):
          snake_case__    =					self.top
          while node:
              yield node.data
              snake_case__    =					node.next
      def __str__(      self			):
          return "->".join([str(lowerCamelCase			) for item in self]			)
      def __len__(      self			):
          return len(tuple(iter(self			)			)			)
      def A_      (      self			):
          return self.top is None
      def A_      (      self		,						lowerCamelCase			):
          snake_case__    =					Node(lowerCamelCase			)
          if not self.is_empty():
              snake_case__    =					self.top
          snake_case__    =					node
      def A_      (      self			):
          if self.is_empty():
              raise IndexError("pop from empty stack"			)
          assert isinstance(self.top		,						lowerCamelCase			)
          snake_case__    =					self.top
          snake_case__    =					self.top.next
          return pop_node.data
      def A_      (      self			):
          if self.is_empty():
              raise IndexError("peek from empty stack"			)

          assert self.top is not None
          return self.top.data



      def A_      (      self			):
          snake_case__    =					None


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

     testmod()



