






import math







def 	_UpperCamelCase   (    )  ->   None:

						"""simple docstring"""



						lowerCAmelCase__    						=						input('Enter message: '		)
						lowerCAmelCase__    						=						int(input(F"Enter key [2-{len(UpperCamelCase_		) - 1}]: "		)		)
						lowerCAmelCase__    						=						input('Encryption/Decryption [e/d]: '		)

						if mode.lower().startswith('e'		):
												lowerCAmelCase__    						=						encrypt_message(UpperCamelCase_    ,       UpperCamelCase_		)
						elif mode.lower().startswith('d'		):
												lowerCAmelCase__    						=						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:

						"""simple docstring"""



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







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

						"""simple docstring"""



						lowerCAmelCase__    						=						math.ceil(len(UpperCamelCase_		) / key		)
						lowerCAmelCase__    						=						key
						lowerCAmelCase__    						=						(num_cols * num_rows) - len(UpperCamelCase_		)
						lowerCAmelCase__    						=						[''] * num_cols
						lowerCAmelCase__    						=						0
						lowerCAmelCase__    						=						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__    						=						0
																		row += 1

						return "".join(UpperCamelCase_		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()













from collections import deque

from .hash_table import HashTable


class     __SCREAMING_SNAKE_CASE					(   __lowercase):






						def __init__(	self     ,						*_UpperCamelCase     ,						**_UpperCamelCase   ):






												"""simple docstring"""
												super().__init__(*_UpperCamelCase     ,						**_UpperCamelCase   )






						def       UpperCamelCase__      (	self     ,						_UpperCamelCase     ,						_UpperCamelCase   ):






												"""simple docstring"""
												lowerCAmelCase__    						=						deque([]   ) if self.values[key] is None else self.values[key]
												self.values[key].appendleft(_UpperCamelCase   )
												lowerCAmelCase__    						=						self.values[key]






						def       UpperCamelCase__      (	self   ):






												"""simple docstring"""
												return (
												    sum(self.charge_factor - len(_UpperCamelCase   ) for slot in self.values   )
												    / self.size_table
												    * self.charge_factor
												)







						def       UpperCamelCase__      (	self     ,						_UpperCamelCase     ,						_UpperCamelCase=None   ):






												"""simple docstring"""
												if not (
												    len(self.values[key]   ) == self.charge_factor and self.values.count(_UpperCamelCase   ) == 0
												):
																		return key
												return super()._collision_resolution(_UpperCamelCase     ,						_UpperCamelCase   )





