title: Find longest substring formed with characters of other string
body: <p>Given two strings:</p>
  
  <pre><code>str1 = "abcdefacbccbagfacbacer"
  str2 = "abc"
  </code></pre>
  
  <p>I've to find the longest substring in <code>str1</code> that is formed by the subset of characters of <code>str2</code>, in this case it would be - <code>7 (acbccba)</code>. 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.</p>
  
  <p>What would be the best way to do this? In fact, is this problem even suitable for a suffix tree, or DP?</p>