Double loop solution in Clear category for The End of Other by bryukh
You can iterate throught set.
for w1 in words:
for w2 in words:
if w1 != w2 and (w1.endswith(w2) or w2.endswith(w1)):
Feb. 20, 2014