one line change
wrote code for displaying the names and count

in a array of objects where the sorting is done and the slicing is also
implemented