title: Removing duplicates in a vector of strings
body: <p>I have a vector of strings:</p>
  
  <pre><code>std::vector&lt;std::string&gt; fName
  </code></pre>
  
  <p>which holds a list of file names <code>&lt;a,b,c,d,a,e,e,d,b&gt;</code>.</p>
  
  <p>I want to get rid of all the files that have duplicates and want to retain only the files that do not have duplicates in the vector.</p>
  
  <pre><code>for(size_t l = 0; l &lt; fName.size(); l++)
  {
      strFile = fName.at(l);
      for(size_t k = 1; k &lt; fName.size(); k++)
      {
          strFile2 = fName.at(k);
          if(strFile.compare(strFile2) == 0)
          {
              fName.erase(fName.begin() + l);
              fName.erase(fName.begin() + k);
          }
      }
  }
  </code></pre>
  
  <p>This is removing a few of the duplicate but still has a few duplicates left, need help in debugging.</p>
  
  <p>Also my input looks like <code>&lt;a,b,c,d,e,e,d,c,a&gt;</code> and my expected output is <code>&lt;b&gt;</code> as all other files b,c,d,e have duplicates they are removed.</p>