Double loop solution in Clear category for The end of other by
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