

'''simple docstring'''







def       UpperCAmelCase__    (      UpperCAmelCase__,       UpperCAmelCase__				)			->			str:
       A_						=      [[] for _ in range(UpperCAmelCase__				)]
       A_						=      key - 1

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

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

       return output_string
def       UpperCAmelCase__    (      UpperCAmelCase__,       UpperCAmelCase__				)			->			str:
       A_						=      []
       A_						=      key - 1

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

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

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

       A_						=      """"""  # reads as zigzag
       for position in range(len(UpperCAmelCase__				)				):
              A_						=      position % (lowest * 2)  # puts it in bounds
              A_						=      min(UpperCAmelCase__,       lowest * 2 - num				)  # creates zigzag pattern
              output_string += grid[num][0]
              grid[num].pop(0				)
       return output_string
def       UpperCAmelCase__    (      UpperCAmelCase__				)			->			dict[int, str]:
       A_						=      {}
       for key_guess in range(1,       len(UpperCAmelCase__				)				):  # tries every key
              A_						=      decrypt(UpperCAmelCase__,       UpperCAmelCase__				)
       return results


if __name__ == "__main__":
      import doctest

      doctest.testmod()



'''simple docstring'''







def       UpperCAmelCase__    (      UpperCAmelCase__,       UpperCAmelCase__,       UpperCAmelCase__ = 0,       UpperCAmelCase__ = 0				)			->			int:
       A_						=      right or len(UpperCAmelCase__				) - 1
       if left > right:
              return -1
       elif list_data[left] == key:
              return left
       elif list_data[right] == key:
              return right
       else:
              return search(UpperCAmelCase__,       UpperCAmelCase__,       left + 1,       right - 1				)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
