re: Nice! Thanks for sharing. :) Have you seen the built-in Counter class? This seems like a perfect use-case for it. from collections import Co...

Bonus! On my machine, this version is even 5 times faster than the best Ruby version!

cat test.py | python -m timeit
100000000 loops, best of 3: 0.00844 usec per loop

This is great. Will use counter effectively. Thanks for showing me counter(). :-)

Code of Conduct Report abuse