Skip to content

Commit 8407733

Browse files
committedApr 21, 2023
feat: add "Regex and Parsing" solution
1 parent f2d49c5 commit 8407733

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎matrix_script.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/python3
2+
3+
import re
4+
5+
6+
first_multiple_input = input().rstrip().split()
7+
n = int(first_multiple_input[0])
8+
m = int(first_multiple_input[1])
9+
10+
matrix = []
11+
for _ in range(n):
12+
matrix_item = input()
13+
matrix.append(matrix_item)
14+
15+
script = ""
16+
for column in zip(*matrix):
17+
script += "".join(column)
18+
19+
print(re.sub(r"([a-zA-Z0-9])[\s!@#$%&]+([a-zA-Z0-9])", r"\1 \2", script))

0 commit comments

Comments
 (0)
Please sign in to comment.