The problem:
Let P be the set of all possible ways of partitioning string s into adjacent and possibly null substrings. I'm looking for an elegant algorithm to solve this problem.
Background context:
Given a tuple of strings (s, w), define P(s) and P(w) as above. There exists a particular partition R ∈ P(s) and T ∈ P(w) that yields the least number of substring Levenshtein (insertion, deletion and substitution) edits.
An example:
Partition string "foo" into 5 substrings, where ε is a null substring:
[ε, ε, f, o, o]
[ε, f, ε, o, o]
[ε, f, o, ε, o]
[ε, f, o, o, ε]
[f, ε, ε, o, o]
[f, ε, o, ε, o]
[f, ε, o, o, ε]
[f, o, ε, ε, o]
[f, o, ε, o, ε]
[f, o, o, ε, ε]