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.
- Prepare
- Python
- Regex and Parsing
- Matrix Script
- Discussions
Matrix Script
Matrix Script
Sort by
recency
|
580 Discussions
|
Please Login in order to post a comment
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)
Very nice. Already checked for trailing spaces. No idea what happened.
Your Output (stdout) This is Matrix# %!
Expected Output This is Matrix# %!
Wow its increadible how much easier this can be done. Thank you for sharing people. I have written solution myself, it gives the same answers in the tests but for some reason it says its not correct in here. Maybe you can help to see why
Edit: I found that i do if r"name"== r"main" and that was the problem!
Easy solution