Created
April 26, 2012 04:29
-
-
Save wting/2495828 to your computer and use it in GitHub Desktop.
codejam: alien language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import re | |
_, lines, cases = map(int,raw_input().split()) | |
words = [] | |
for _ in xrange(lines): | |
words.append(raw_input()) | |
for c in xrange(cases): | |
pattern = raw_input().replace('(','[').replace(')',']') | |
p = re.compile(pattern) | |
found = 0 | |
for w in words: | |
if p.search(w) != None: found += 1 | |
print 'Case #%i: %i' % (c+1,found) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment