Strings-Max Frequency Character

My code passing all test case but I don’t feel it is good. can anyone check.

here is my link https://ide.codingblocks.com/s/415518