Rajan Kumar

Rajan Kumar published an article

3 months ago

Find maximum occurring character in a string


Problem

You are given an string S, Your task is to find out the character whose occurance is most. If there are more than 1 character which have same occurance, then print the one that comes alphabetically first. 

Example

Input

HackersFriend

Output

e

Here in this example, we can see there are two characters which are occuring 2 times, e and r. But e comes first alphabetically, so we print e as our output.

 

Solution

We will use Hashing to solve this problem efficiently.


arrow_upward Upvote

comment Comment

arrow_downward downvote




Go back to feed

HackersFriend Updates


update Aug. 15, 2019, 1:47 p.m.

Full view page of article has been changed to match style of homepage feed. open_in_new


update Aug. 14, 2019, 12:52 a.m.

Total number posts on homepage is incresed to 10 by default and text-decoration of link to post and author is changed. open_in_new


update Aug. 7, 2019, 1:51 a.m.

We changed our homepage. Now, you can see newly published articles, directly on home page. open_in_new


View more


Events


event Nov. 28, 2018, 5:30 p.m.

Python from zero to hero

place Delhi

View details



event Aug. 13, 2018, 5:30 p.m.

Python from zero to hero

place Bangalore ( HackersFriend office BTM Layout)

View details