Skip to content

Instantly share code, notes, and snippets.

@eric-wieser
Created January 24, 2012 08:46
Show Gist options
  • Save eric-wieser/1668941 to your computer and use it in GitHub Desktop.
Save eric-wieser/1668941 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