
import math




def  __magic_name__ (   )			->   None:
				__lowerCamelCase    					=	input('''Enter message: '''							)
				__lowerCamelCase    					=	int(input(f'''Enter key [2-{len(__lowerCAmelCase							) - 1}]: '''							)							)
				__lowerCamelCase    					=	input('''Encryption/Decryption [e/d]: '''							)

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

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




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




def  __magic_name__ (   __lowerCAmelCase	:						int		,  __lowerCAmelCase	:						str							)			->   str:
				__lowerCamelCase    					=	math.ceil(len(__lowerCAmelCase							) / key							)
				__lowerCamelCase    					=	key
				__lowerCamelCase    					=	(num_cols * num_rows) - len(__lowerCAmelCase							)
				__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(__lowerCAmelCase							)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()





from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader

class    lowerCAmelCase__     (	__lowercase			):






		def __init__(		self		:							Tuple							,			SCREAMING_SNAKE_CASE__		:							NestedDataStructureLike[PathLike]							,			SCREAMING_SNAKE_CASE__		:							Optional[NamedSplit] = None							,			SCREAMING_SNAKE_CASE__		:							Optional[Features] = None							,			SCREAMING_SNAKE_CASE__		:							str = None							,			SCREAMING_SNAKE_CASE__		:							bool = False							,			SCREAMING_SNAKE_CASE__		:							bool = False							,			SCREAMING_SNAKE_CASE__		:							Optional[int] = None							,			**SCREAMING_SNAKE_CASE__		:							str							,			)     ->							Union[str, Any]:
						super().__init__(
						    SCREAMING_SNAKE_CASE__							,			split=SCREAMING_SNAKE_CASE__							,			features=SCREAMING_SNAKE_CASE__							,			cache_dir=SCREAMING_SNAKE_CASE__							,			keep_in_memory=SCREAMING_SNAKE_CASE__							,			streaming=SCREAMING_SNAKE_CASE__							,			num_proc=SCREAMING_SNAKE_CASE__							,			**SCREAMING_SNAKE_CASE__							,			)
						__lowerCamelCase    					=	path_or_paths if isinstance(SCREAMING_SNAKE_CASE__							,			SCREAMING_SNAKE_CASE__  ) else {self.split: path_or_paths}
						__lowerCamelCase    					=	Text(
						    cache_dir=SCREAMING_SNAKE_CASE__							,			data_files=SCREAMING_SNAKE_CASE__							,			features=SCREAMING_SNAKE_CASE__							,			**SCREAMING_SNAKE_CASE__							,			)







		def  __A       (		self		:							int  )     ->							Dict:
						# Build iterable dataset
						if self.streaming:
										__lowerCamelCase    					=	self.builder.as_streaming_dataset(split=self.split  )
						# Build regular (map-style) dataset
						else:
										__lowerCamelCase    					=	None
										__lowerCamelCase    					=	None
										__lowerCamelCase    					=	None
										__lowerCamelCase    					=	None

										self.builder.download_and_prepare(
										    download_config=SCREAMING_SNAKE_CASE__							,			download_mode=SCREAMING_SNAKE_CASE__							,			verification_mode=SCREAMING_SNAKE_CASE__							,			base_path=SCREAMING_SNAKE_CASE__							,			num_proc=self.num_proc							,			)
										__lowerCamelCase    					=	self.builder.as_dataset(
										    split=self.split							,			verification_mode=SCREAMING_SNAKE_CASE__							,			in_memory=self.keep_in_memory  )
						return dataset



