title: Finding Randomly Order Substring in String
body: <p>For my first part of the question, We have given a long string of input and we have to count the occurrence for it. 
  For eg. </p>
  
  <pre><code>Input = AXBHAAGHXAXBH
  Find = AXBH
  Output = 2
  </code></pre>
  
  <p>This can be achieved by using the <code>string.find("term")</code> loop. Eg. </p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  int main()
  {
     int occurrences = 0;
     std::string::size_type pos = 0;
     std::string inputz = "AXBHAAGHXAXBH";
     std::string target = "AXBH";
     while ((pos = inputz.find(target, pos )) != std::string::npos) {
            ++ occurrences;
            pos += target.length();
     }
     std::cout &lt;&lt; occurrences &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>However, I am not sure how to do the second part where, it needs to take into account the random structure:
  Random structure refers to any orientation of our find. Important note: The find occurrences are always grouped together but can have different structure.
  I do not want to use cases because some sample find are too big eg. Find <strong>AXBHNMB</strong> would have too many cases to consider and would prefer a more general approach.</p>
  
  <pre><code>Eg. AXBH is find, then AXHB is also acceptable for the occurence
  </code></pre>
  
  <p>A proper example:</p>
  
  <pre><code>Input = AXBHAAGHXAXBH**ABHX**NBMN**AHBX**
  Find = AXBH
  Output = 4
  </code></pre>
  
  <p>Prefer if you please code it for the given example with link to explanation/explanation to any new function you use.</p>