'''simple docstring'''





def 	lowerCAmelCase_				(					snake_case_       : list					,    snake_case_       : int					,    snake_case_       : int = 0					,    snake_case_       : int = 0			)    ->      int:


     '''simple docstring'''




     UpperCAmelCase_           =   right or len(snake_case_			) - 1
     if left > right:
          return -1
     elif list_data[left] == key:
          return left
     elif list_data[right] == key:
          return right
     else:
          return search(snake_case_					,    snake_case_					,    left + 1					,    right - 1			)


if __name__ == "__main__":
    import doctest

    doctest.testmod()





'''simple docstring'''





import math





def 	lowerCAmelCase_				(					)    ->      None:


     '''simple docstring'''




     UpperCAmelCase_           =   input("Enter message: "			)
     UpperCAmelCase_           =   int(input(f"""Enter key [2-{len(snake_case_			) - 1}]: """			)			)
     UpperCAmelCase_           =   input("Encryption/Decryption [e/d]: "			)

     if mode.lower().startswith("e"			):
          UpperCAmelCase_           =   encrypt_message(snake_case_					,    snake_case_			)
     elif mode.lower().startswith("d"			):
          UpperCAmelCase_           =   decrypt_message(snake_case_					,    snake_case_			)

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





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : str			)    ->      str:


     '''simple docstring'''




     UpperCAmelCase_           =   [""] * key
     for col in range(snake_case_			):
          UpperCAmelCase_           =   col
          while pointer < len(snake_case_			):
               cipher_text[col] += message[pointer]
               pointer += key
     return "".join(snake_case_			)





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : str			)    ->      str:


     '''simple docstring'''




     UpperCAmelCase_           =   math.ceil(len(snake_case_			) / key			)
     UpperCAmelCase_           =   key
     UpperCAmelCase_           =   (num_cols * num_rows) - len(snake_case_			)
     UpperCAmelCase_           =   [""] * num_cols
     UpperCAmelCase_           =   0
     UpperCAmelCase_           =   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)
          ):
               UpperCAmelCase_           =   0
               row += 1

     return "".join(snake_case_			)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()




