title: Array grouping valus with count
body: <p>I have an array with values </p>
  
  <p><code>Munnar, Cochin, Cochin, Cochin, Munnar, Cochin</code> </p>
  
  <p>I need to group the values as</p>
  
  <p><code>Munnar(1), Cochin(3), Munnar(1), Cochin(1)</code>. </p>
  
  <p>How can loop the array to get  the desired output.</p>