title: How to compress a string
body: <p>I had this question in one of my interviews:</p>
  
  <blockquote>
    <p>Given a string how would you compress it?</p>
  </blockquote>
  
  <p>Example input is not in the form of <code>aabbccdd</code> but like <code>abcdgehrk</code>. i.e. all <code>chars</code> in the <code>string</code> are different.(Note:Run Length Encoding wont work ,as it was one of the solutions which I gave but he said string does not have any repetitive characters)</p>
  
  <p>I gave the following two solutions but he did not accept them:</p>
  
  <p>1) HashCode cannot be a solution as it will store numbers<br>
  2) Can't store in binary as its not human readable format</p>
  
  <p>Can anyone please suggest what could be another solution for this problem?</p>