Skip to content

Instantly share code, notes, and snippets.

@christianroman
Last active December 12, 2015 12:38
Show Gist options
  • Save christianroman/4772868 to your computer and use it in GitHub Desktop.
Save christianroman/4772868 to your computer and use it in GitHub Desktop.
SGCODE 12 Febrero
lines, out = [line.strip() for line in open('data.in')], ''
for x in xrange(1, int(lines[0])+1):
l = lines[x].upper()
import re
for w in l.split(' '):
m = re.search('^h.+o|^p.*r$', w, re.IGNORECASE)
l = l.replace(w, "#" * w.__len__()) if m and m.groups() > 0 else l
out += l + "\n"
with open ('data.out', 'w') as f: f.write (out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment