Exercise: Overlapping Removals Yielding Existing Words

Write a program that finds words from which one can remove either and both of two overlapping substrings and the results are existing words, too. Example:

weakhearted
 |---|      → warted
  |-----|   → weed
 |------|   → wed

Solutions

Origin

I needed to construct examples for explaining the transform function in the distributed text editor. Of course, you could use some abcdefg strings, but that would be boring.