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:

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



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.