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
|
539 Discussions
|
Please Login in order to post a comment
s = "".join(list(chain.from_iterable(zip(*matrix)))) print(re.sub(r"\b\W+\b", " ", s))
raw_output = '' for j in range(m): for i in range(n): raw_output += matrix[i][j]
print(re.sub(r'(?<=[a-z0-9])[!@#$%&\s]+(?=[a-z0-9])', ' ', raw_output, flags=re.I))
There is a bug in unlocked test case.
Steps to reproduce: If you print
It gets accepted as correct answer, while it definitely is not due to invalid character :
%
Maybe a bit stupid, but works :D