• + 0 comments
    import sys, re
    
    matrix = sys.stdin.read().splitlines()
    
    columns_count = int(matrix[0][2])
    matrix = matrix[1:]
    columns = []
    i=0
    
    for _ in range(columns_count):   
        for line in matrix:
            columns.append(line[i])
    
        i+=1
    
    columns = ''.join(columns)
    decrypted = re.sub(r'(?<=\w)[^\w]+(?=\w)', ' ', columns)
    
    print(decrypted)