Suppose we're given a string like aabaccbbca, and want to find a short string that's not a substring of this string. However, we're limited to using the characters that appear in the string: in this case we can use 'a's, 'b's, and 'c's, but nothing else.In that example case, there's no length-0, length-1, or length-2 solutions. There's lots of length-3 solutions. Actually, finding the minimum length is a lot more interesting than finding a specific solution.So my question is: how can we efficiently compute the minimum length for which solutions exist to this 'find string with same alphabet that doesn't appear as a substring' problem?Examples: minLengthMissingSubstring() == 1 minLengthMissingSubstring(a) == 2 minLengthMissingSubstring(abc) == 2 minLengthMissingSubstring(aabaccbbca) == 3 minLengthMissingSubstring(abbaccbbca) == 2 minLengthMissingSubstring(    0001002003004011012013014021022 +    0230240310320330340410420430441 +    1121131141221231241321331341421 +    22423323424324433343444431442223) == 4
Minimum length of string using chars appearing in a given string but not a substring of that string
algorithms;strings