• + 0 comments

    matrix = [list(i) for i in zip(*matrix)] matrix = sum(matrix, []) string = "".join(matrix)

    pattern = "[A-Za-z0-9][^A-Za-z0-9]+[A-Za-z0-9]"

    betweens = re.findall(pattern, string) for substr in betweens: string = string.replace(substr[1:-1], ' ', 1)

    print(string)