Skip to content

Instantly share code, notes, and snippets.

@mrvnmchm
Created October 26, 2019 00:51
Show Gist options
  • Save mrvnmchm/669a5393dc01688d64c2255ca66c26d1 to your computer and use it in GitHub Desktop.
Save mrvnmchm/669a5393dc01688d64c2255ca66c26d1 to your computer and use it in GitHub Desktop.
import re
# Import original script
matrix = list()
for _ in range(int(input().split()[0])):
matrix.append(list(input()))
# Rotate the matrix
matrix = list(zip(*matrix))
# Prep regex sample
sample = str()
for subset in matrix:
for letter in subset:
sample += letter
# Substitute invalid characters with a space
print(re.sub(r'(?<=\w)([^\w\d]+)(?=\w)', ' ', sample))
@mrvnmchm
Copy link
Author

Why was this so confusing, smh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment