Given two strings:

```
str1 = "abcdefacbccbagfacbacer"
str2 = "abc"

```

I've to find the longest substring in `str1` that is formed by the subset of characters of `str2`, in this case it would be - `7 (acbccba)`. What would be the approach to solve this in least complexity. First I thought of DP. But, I guess DP is really not required for this, as we have to search for substring, and not subsequence. Then I though of suffix tree. But that would require extra pre-processing time.

What would be the best way to do this? In fact, is this problem even suitable for a suffix tree, or DP?