Arrange character frequency

https://ide.codingblocks.com/s/345267 this is the question
https://ide.codingblocks.com/s/345269 this is the solution its not giving correct output. pls check my code as soon as possible.pls