title: having a map of strings how to compare it to given string
body: <p>We have map of string pairs like name:location (unix like absolute location a la <code>myfolder/</code>). We are given with some location a la <code>myfolder/mysubfolder/myfile</code>. How to find which of maps location fit to given url most?</p>
  
  <p>Example we have a map like:</p>
  
  <pre><code>service1:myfolder/
  service2:myfolder/mysubfolder/
  service3:myfolder/myothersubfolder/
  service4:myfolder/mysubfolder/myfile
  </code></pre>
  
  <p>We are given value <code>myfolder/mysubfolder/myfile/blablabla/</code> (string). 
  We want to find out to which item in our map it relates the most.
  Search result shall be <code>service4</code> as map item with most related content.</p>
  
  <p>So how to find by given string value to which map element it relates the most?</p>
  
  <p>Please provide some code because I am C++ nube and do not get how to inplement such thing?</p>
  
  <p>So I simplified a problem a bit - <a href="https://stackoverflow.com/questions/5997723/having-a-map-with-paths-how-to-compare-tham-to-given-path">now all relation I need is in how deep given path is</a> which in string case can be aceived by just iteratin over all maps paths looking at thare langth , searching for appearence in given path and remembering most long map item path found in given path.</p>