Regarding maximum occurance of a character

There is a program on to find the character with maximum occurance and I have made a program but it is giving me time limit error. How can I optimize my code??


@sarthak_singhal corrected your code but I think your logic is not correct for this.

I have done some changes in my program and I have made some more comments too to tell my logic https://ide.codingblocks.com/s/445708

@sarthak_singhal check now: