Skip to content

Instantly share code, notes, and snippets.

@charliermarsh
Created April 19, 2014 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charliermarsh/11092828 to your computer and use it in GitHub Desktop.
Save charliermarsh/11092828 to your computer and use it in GitHub Desktop.
stuff.py
import re
f = open('D-small-2-attempt0.in.txt','r')
T = int(f.readline())
for t in range(T):
s = f.readline()
counter = 0
ghosts = re.findall(r'GHOST', s)
while len(ghosts):
counter += len(ghosts)
s = s.replace('GHOST', '')
ghosts = re.findall(r'GHOST', s)
print "Case #" + str(t+1) + ": " + str(counter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment