Skip to content

Instantly share code, notes, and snippets.

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