title: Multiple string array comparisons
body: <p>I have a main array that contains some strings. For each value of main array, I want to check in subarray with which strings it appeared and how many times. For example, I have following arrays:</p>
  
  <blockquote>
    <p>Main input</p>
  </blockquote>
  
  <pre><code>mainArray = {A, B, C, P}
  
  Subarrays
  arrayA = {a,c,d,m,o}
  arrayB = {b,c,p,q,r}
  arrayC = {a,p,q,r,t,e,o}
  ……………………………
  ……………………………
  arrayN = {a,c,p,n,o}
  </code></pre>
  
  <p>Now I want to check where A,B,C, and P appeared together and how many times. It should generate following output:</p>
  
  <pre><code>resultArray = {{a,b,0}{a,c,2}{a,p,1}{b,c,0}{b,p,0}{c,p,2}}
  </code></pre>
  
  <p>Last step would be, how many times each string of main array appeared in subarrays:</p>
  
  <blockquote>
    <p>Final output</p>
  </blockquote>
  
  <pre><code>lastArray = A=3,B=0,C=4,P=3
  </code></pre>
  
  <p>I would have thousands of main arrays and thousands of sub arrays. Thus, performance is an issue too :(</p>