title: Remove all the occurences of substrings from a string
body: <p>Given a string <code>S</code> and a set of <code>n</code> substrings. Remove every instance of those <code>n</code> substrings from <code>S</code> so that <code>S</code> is of the minimum length and output this minimum length.</p>
  
  <p><strong>Example 1</strong></p>
  
  <pre><code>S = ccdaabcdbb
  n = 2
  substrings = ab, cd
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>2
  </code></pre>
  
  <p>Explanation:</p>
  
  <pre><code>ccdaabcdbb -&gt; ccdacdbb -&gt; cabb -&gt; cb (length=2)
  </code></pre>
  
  <p><strong>Example 2</strong></p>
  
  <pre><code>S = abcd
  n = 2
  substrings = ab,bcd
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code> 1
  </code></pre>
  
  <p>How do I solve this problem ?</p>