Skip to content

Instantly share code, notes, and snippets.

@jacopo-j
Last active November 18, 2017 15:37
Show Gist options
  • Save jacopo-j/975a4aafa442b67b52a0fcbd18a509c7 to your computer and use it in GitHub Desktop.
Save jacopo-j/975a4aafa442b67b52a0fcbd18a509c7 to your computer and use it in GitHub Desktop.
def j(a,c,e=0):
for g in a.split(";"):
if all(c.count(h)>=g.count(h)for h in g):
i=sum([int("1414144810022213A111440008"[ord(h)-97],16)for h in g])
if(i>e):e,f=i,g
print f
j("italia;informatica;reddit;dirette", "ddeeirtt")
j("infamatori;informati;firmanti;infarcito;informatica", "aacfiimnort")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment