You are viewing a single comment's thread. Return to all comments →
Solution I made
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 i in range(m)]
for _ in range(n): matrix_item = input() for j in range(len(matrix_item)): matrix[j] = matrix[j]+str(matrix_item[j])
encoded = "".join(matrix) print(re.sub(r'(?<=\w)[^\w]+(?=\w)', ' ', encoded))
Seems like cookies are disabled on this browser, please enable them to open this website
Matrix Script
You are viewing a single comment's thread. Return to all comments →
Solution I made
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 i in range(m)]
for _ in range(n): matrix_item = input() for j in range(len(matrix_item)): matrix[j] = matrix[j]+str(matrix_item[j])
encoded = "".join(matrix) print(re.sub(r'(?<=\w)[^\w]+(?=\w)', ' ', encoded))