Skip to content

Instantly share code, notes, and snippets.

@henix
Created September 4, 2013 04:15
Show Gist options
  • Save henix/6432694 to your computer and use it in GitHub Desktop.
Save henix/6432694 to your computer and use it in GitHub Desktop.
#!/usr/bin/python2
import sys
import re
records = []
for line in sys.stdin:
records.append(re.match(r'[ ]*(\d)+ ([^ ]+)(.*)', line.rstrip()).groups())
for record in sorted(records, key=lambda d:int(d[0])*(len(d[1])+len(d[2])), reverse=True):
print "%s %s%s" % record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment