title: Java String manipulation based on most frequent char count
body: <p>In recent interview, I was asked to find solution for below String manipulation program. 
  <strong><em>Given a string s, represent the most frequent character with 1, the 2nd most frequent character with 01, third with 001 etc.</em></strong> </p>
  
  <blockquote>
    <h2>if String is "marrymyyyr", then output should be :</h2>
    
    <p>char count for each character is m:2 , a:1, r:3, y:4  highest count
    number is 4 so the character with that count should be printed 1
    inplace of that char, char with count 3 should be printed as 01
    inplace of that char and so on.</p>
    
    <h2>Output : 001(m)0001(a)01(r)01(r)1(y)001(m)1(y)1(y)1(y)01(r)</h2>
  </blockquote>
  
  <p>I used HashMap to keep track of count for each character. then I was unable to solve the problem. I know I have to implement some mechanism to apply hashing/mapping to hashmap based on most frequent char mapped with its correspondence resultant string with combination of"1" "0" and print char with mapped resultant string instead of that char.</p>