• + 0 comments
    def encryption(s: str) -> str:
        temp = s.replace(" ", "")
        cols = ceil(sqrt(len(temp)))
        batch = list(batched(temp, cols))
        result = [[word[c] for word in batch if len(word) > c] for c in range(cols)]
        return " ".join("".join(x) for x in result)