





'''simple docstring'''






def 					_a   (__SCREAMING_SNAKE_CASE  ,      __SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			=[[] for _ in range(__SCREAMING_SNAKE_CASE   )]
  _UpperCamelCase       			=key - 1

  if key <= 0:
    raise ValueError('''Height of grid can\'t be 0 or negative'''   )
  if key == 1 or len(__SCREAMING_SNAKE_CASE   ) <= key:
    return input_string

  for position, character in enumerate(__SCREAMING_SNAKE_CASE   ):
    _UpperCamelCase       			=position % (lowest * 2)  # puts it in bounds
    _UpperCamelCase       			=min(__SCREAMING_SNAKE_CASE  ,      lowest * 2 - num   )  # creates zigzag pattern
    temp_grid[num].append(__SCREAMING_SNAKE_CASE   )
  _UpperCamelCase       			=[''''''.join(__SCREAMING_SNAKE_CASE   ) for row in temp_grid]
  _UpperCamelCase       			=''''''.join(__SCREAMING_SNAKE_CASE   )

  return output_string


def 					_a   (__SCREAMING_SNAKE_CASE  ,      __SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			=[]
  _UpperCamelCase       			=key - 1

  if key <= 0:
    raise ValueError('''Height of grid can\'t be 0 or negative'''   )
  if key == 1:
    return input_string

  _UpperCamelCase       			=[[] for _ in range(__SCREAMING_SNAKE_CASE   )]  # generates template
  for position in range(len(__SCREAMING_SNAKE_CASE   )   ):
    _UpperCamelCase       			=position % (lowest * 2)  # puts it in bounds
    _UpperCamelCase       			=min(__SCREAMING_SNAKE_CASE  ,      lowest * 2 - num   )  # creates zigzag pattern
    temp_grid[num].append('''*'''   )

  _UpperCamelCase       			=0
  for row in temp_grid:  # fills in the characters
    _UpperCamelCase       			=input_string[counter : counter + len(__SCREAMING_SNAKE_CASE   )]
    grid.append(list(__SCREAMING_SNAKE_CASE   )   )
    counter += len(__SCREAMING_SNAKE_CASE   )

  _UpperCamelCase       			=''''''  # reads as zigzag
  for position in range(len(__SCREAMING_SNAKE_CASE   )   ):
    _UpperCamelCase       			=position % (lowest * 2)  # puts it in bounds
    _UpperCamelCase       			=min(__SCREAMING_SNAKE_CASE  ,      lowest * 2 - num   )  # creates zigzag pattern
    output_string += grid[num][0]
    grid[num].pop(0   )
  return output_string


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			={}
  for key_guess in range(1  ,      len(__SCREAMING_SNAKE_CASE   )   ):  # tries every key
    _UpperCamelCase       			=decrypt(__SCREAMING_SNAKE_CASE  ,      __SCREAMING_SNAKE_CASE   )
  return results


if __name__ == "__main__":
      import doctest

      doctest.testmod()













'''simple docstring'''






from __future__ import annotations

import sys
from collections import deque
from typing import Generic, TypeVar

__lowerCamelCase						: Optional[int]		=   TypeVar('T')







class 		UpperCAmelCase   (				Generic[T]):


  """simple docstring"""







  lowerCAmelCase_					=				42  # Cache store of keys
  lowerCAmelCase_					=				42  # References of the keys in cache
  lowerCAmelCase_					=				10  # Maximum capacity of cache


  def __init__(				self    :					Union[str, Any]							,	UpperCamelCase__    :					int  )     ->						None:
    _UpperCamelCase       			=deque()
    _UpperCamelCase       			=set()
    if not n:
      _UpperCamelCase       			=sys.maxsize
    elif n < 0:
      raise ValueError('''n should be an integer greater than 0.'''  )
    else:
      _UpperCamelCase       			=n


  def   UpperCamelCase__      (				self    :					List[str]							,	UpperCamelCase__    :					T  )     ->						None:
    if x not in self.key_reference:
      if len(self.dq_store  ) == LRUCache._MAX_CAPACITY:
        _UpperCamelCase       			=self.dq_store.pop()
        self.key_reference.remove(UpperCamelCase__  )
    else:
      self.dq_store.remove(UpperCamelCase__  )

    self.dq_store.appendleft(UpperCamelCase__  )
    self.key_reference.add(UpperCamelCase__  )


  def   UpperCamelCase__      (				self    :					Union[str, Any]  )     ->						None:
    for k in self.dq_store:
      print(UpperCamelCase__  )




  def __repr__(				self    :					str  )     ->						str:
    return F'''LRUCache({self._MAX_CAPACITY}) => {list(self.dq_store  )}'''


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      __lowerCamelCase						: LRUCache[str | int]		=   LRUCache(4)
      lru_cache.refer('A')
      lru_cache.refer(2)
      lru_cache.refer(3)
      lru_cache.refer('A')
      lru_cache.refer(4)
      lru_cache.refer(5)
      lru_cache.display()

      print(lru_cache)
      assert str(lru_cache) == "LRUCache(4) => [5, 4, 'A', 3]"






