stevena has asked for the wisdom of the Perl Monks concerning the following question:
Given a lexicon with long words and short words (happening to be length 9 and up, and 8 and down, respectively), I am looking to enumerate all minimal extensions of a short by a long; that is, with no intervening word (either long or short) that extends the short and is extended by the long. (Extensions could also be called strict superstrings.)
I.e., if 'w > x' means word w extends word x, I want to find all pairs (L, S), such that:
* L > S
* there's no W with L > W > S,
where L, S, W are restricted to lexicon words.
For example, (NUMERICAL, NUMERIC) is desired, but not (SOCIOBIOLOGIST, OLOGIST) because SOCIOBIOLOGIST > BIOLOGIST > OLOGIST.
I am looking for transparent code conducive to my adding less interesting constraints. (Fine if you guide me without writing the code. Also happy to see code.)
Not homework or work -- solely hobby-related. Thanks!