Skip to content

Instantly share code, notes, and snippets.

@dferrante
Created December 27, 2020 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dferrante/dd67e18bb1ac312f3a59b6a5c0307d69 to your computer and use it in GitHub Desktop.
Save dferrante/dd67e18bb1ac312f3a59b6a5c0307d69 to your computer and use it in GitHub Desktop.
longest words where cutting off a letter one by one is still a word
In [35]: for w in sorted(l, key=lambda x: len(x), reverse=True):
...: orig = w
...: wl = len(w)
...: while len(w) > 2:
...: w = w[:-1]
...: if w not in d:
...: break
...: if len(w) == 2:
...: print(orig)
...: wwl = len(orig)
...: if len(orig) < wwl:
...: break
...:
...:
ballonets
balloters
barretter
barrettes
canalised
canalises
carolinas
carolines
champerty
collarets
composers
isthmians
machinery
marshalls
minimised
minimiser
minimises
patentees
patenters
photomaps
quarterns
reversers
reversist
sheathery
sheathers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment