title: Count strings in a range
body: <p>Given N strings numbered 1 to N. We need to answer Q queries. </p>
  
  <p>Each query is of the form <strong>l r S</strong> </p>
  
  <p>For each query, we need to print the number of times the string S appears in the range [l,r].</p>
  
  <p>Example : </p>
  
  <p>Let N=3 and strings are  :</p>
  
  <pre><code>abc
  def
  abc
  </code></pre>
  
  <p>Say we have 3 queries : </p>
  
  <p><strong>Query 1 : 1 2 abc</strong></p>
  
  <p>Then answer is 1</p>
  
  <p><strong>Query 2 : 1 3 abc</strong></p>
  
  <p>Then answer is 2</p>
  
  <p><strong>Query 3 : 1 2 hgj</strong></p>
  
  <p>Then answer is 0</p>
  
  <p>How to answer the queries in efficient way if both N and Q can be upto 100000 . Also Size of each string in the input is greater than or equal to 5 and less than or equal to 10.</p>