Inspired by this
Your task today: given two strings, find the string with the lowest maximum Levenshtein distance to the input strings. For example, using
Seggan, the average string will be
Steggan. It is distance 2 from
Steffan (replace the
ff), and 1 from
Seggan (add a
t). That gives it a maximum distance of 2.
- If there are multiple possibilities, output any of them or all of them (duplicates are OK)
- The inputs are distinct
- The input will be given in uppercase or lowercase ASCII, you choose
- There will always be common letters in the inputs
- The outputs will only have letters from the inputs
- There will always be a solution satisfying the above constraints
As this is code-golf, shortest code in bytes wins.
seggan, steffan -> ['seffan', 'sefgan', 'segfan', 'stefgan', 'stegfan', 'steggan'] (2) hello, ho -> ['hllo', 'hlo', 'helo', 'heo'] (2) string, ring -> ['tring', 'sring'] (1), aaa, aaaa -> ['aaa', 'aaaa'] (1) abc, abcd -> ['abc', 'abcd', 'abd', 'abca', 'abcb', 'abcc'] (1)