• + 0 comments

    Easy solution

    tekst = ""
    for i in range(m):
        for j in range(n):
            tekst += matrix[j][i]
    print(re.sub(r'(?<=[a-zA-Z0-9])[^a-zA-Z0-9]+(?=[a-zA-Z0-9])', ' ', tekst))