We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import math
import os
import random
import re
import sys
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
for _ in range(n):
matrix_item = [char for char in input()]
matrix.append(matrix_item)
zipped_list = list(zip(*matrix))
for i in range(m):
zipped_list[i] = "".join(zipped_list[i])
decodedMsg = "".join(zipped_list)
Matrix Script
You are viewing a single comment's thread. Return to all comments →
import math import os import random import re import sys
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
for _ in range(n): matrix_item = [char for char in input()] matrix.append(matrix_item) zipped_list = list(zip(*matrix)) for i in range(m): zipped_list[i] = "".join(zipped_list[i]) decodedMsg = "".join(zipped_list)
matches = re.sub(r'(?<=\w)[^\w]+(?=\w)',' ', decodedMsg) print(matches)