title: Algorithm to print asterisks for duplicate characters
body: <p>I was asked this question in an interview:<br>
  Given an array with the input string, display the output as shown below</p>
  
  <p><strong>Input</strong> </p>
  
  <pre><code>INDIA  
  </code></pre>
  
  <p><strong>Output</strong> </p>
  
  <pre><code>INDA  
  ****  
  * 
  </code></pre>
  
  <p>I iterated through the array and stored each character as a key in <code>std::map</code> with value as number of occurrence. Later I iterate the map and print the asteriks and reduce the value in the map for each character.</p>
  
  <p>Initially, I was asked not to use any library. I gave a solution which needed lot of iterations. For every character, iterate the complete array till the index to find previous occurrences and so on. 
  Is there any better way, e.g. better complexity, such as faster operation, by which this can be achieved?</p>