• + 0 comments
    def encryption(s):
        # Write your code here
        n = len(s)
        x = math.sqrt(n)
        # nr = math.floor(1x)
        nc = math.ceil(x)
        # print(n, nc)
    
        i = 0
        j = 0
        q = []
        for _ in range(n):
            if i+j > n-1:
                q.append(' ')
                j += 1
                i = 0
            q.append(s[i+j])
            i += nc
            
        return ''.join(q)