I have developed code for finding character that appears max times in a string. Wanted to know, any better version of this. If two characters appear same number of times then whichever appaers first is given priority.