title: Efficient algorithm for finding subset with doubles and subset is together
body: <p>I have two arrays with letters.
  I want to know if array A is contained in array B as follows:
  The letters in A must appear adjacent to each other in array B but do not have to appear in the same order as they were in array A.
  Example that would be accepted</p>
  
  <p>A = abcd
  B = hbadcg</p>
  
  <p>A = aabc
  B = abcag</p>
  
  <p>Examples that would not be accepted</p>
  
  <p>A = aabcd
  B = adcbga</p>
  
  <p>A = abcd
  B = abbcdg</p>
  
  <p>What I could do is for every variation of A check if its a sub string in B. but I'm looking for a better way</p>