Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Invariant solution in Creative category for Moria Doors by veky
def find_word(m):
def likeness(*a):
(w,W), (l,L), (s,S) = a, sorted(map(len, a)), map(set, a)
return (w[0]==W[0]) + (w[-1]==W[-1]) + 3*l/L + 5*len(s&S)/len(s|S)
ws = [w.strip(__import__("string").punctuation) for w in m.lower().split()]
return max(reversed(ws), key=lambda w:sum(likeness(w, W) for W in ws))
Sept. 25, 2014
Comments: