title: find an optimal string(with minimal length) from a set of strings so that resulting string must contain anargram of every string
body: <p>Suppose you have two strings. 
  "abcde" and "dfbag". The resulting string can be "ceabdfg".
  The first five characters of the resulting string "ceadb" is the anargram of "abcde". The last five characters "abdfg" is also an anargram of second string(dfbag).</p>
  
  <p>You can find the optimal string of two strings very easily.</p>
  
  <ol>
  <li><p>Take the common set of characters all present in two strings. for the above example 'a', 'd' and 'b' are present in both two strings. So take those character in any order.(adb, dba, bda , etc.) </p></li>
  <li><p>Take the remaining characters of first string and put them in front. 'c' and 'e' are the remaining characters for first string. So put them in front. so we found "ceabd". its an anargram of first string.</p></li>
  <li><p>Take the remaining characters of second string and put them at the end of the string. 'f' and 'g' are remaining characters from second string. If we put them after the string found in 2, we get "ceadbfg" where "adbfg" is the anargram of the second string.</p></li>
  </ol>
  
  <p>My question is what can be the algorithm to find the optimal resulting string if there are N number of strings? </p>
  
  <p>Example:</p>
  
  <p>We have 4 strings."abc", "ca", "bd", "d"</p>
  
  <p>The optimal string can be "dbca".</p>
  
  <p>Substring "bca" of "dbca" is the anargram of "abc"</p>
  
  <p>Substring "ca" of "dbca" is the anargram of "ca"</p>
  
  <p>Substring "db" of "dbca" is the anargram of "bd"</p>
  
  <p>Substring "d" of "dbca" is the anargram of "d"</p>
  
  <p>I am looking for an algorithm for this. (Ofcourse not the brute force one which checks the all combination :)). Without brute force, any idea?</p>