title: Best way to remove duplicate characters (words) in a string?
body: <p>What would be the best way of removing any duplicate characters and sets of characters separated by spaces in string?</p>
  
  <p>I think this example explains it better:</p>
  
  <pre><code>foo = 'h k k h2 h'
  </code></pre>
  
  <p>should become: </p>
  
  <pre><code>foo = 'h k h2' # order not important
  </code></pre>
  
  <p>Other example:</p>
  
  <pre><code>foo = 's s k'
  </code></pre>
  
  <p>becomes:</p>
  
  <pre><code>foo = 's k'
  </code></pre>