Skip to content

Instantly share code, notes, and snippets.

@eric-wieser
Forked from eric-wieser/alphabet-soup.py
Created January 24, 2012 18:16
Show Gist options
  • Save eric-wieser/1671634 to your computer and use it in GitHub Desktop.
Save eric-wieser/1671634 to your computer and use it in GitHub Desktop.
One-line solution for Alphabet Soup
inFile = open('alphabet.in')
outFile = open('alphabet.out', 'w')
print >> outFile, '\n'.join(
'Case #%d: %d' % (i + 1,
(lambda s, target: min(s.count(l) / target.count(l) for l in target))
(inFile.readline(), 'HACKERCUP')
) for i in xrange(int(inFile.readline()))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment