Rajan Kumar

rajan

Founder & Programmer at HackersFriend Updated Aug. 17, 2019, 1:50 a.m. ⋅ 82 views

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





View more


Events


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

Python from zero to hero

place Delhi

View details


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

Python from zero to hero

place Bangalore ( HackersFriend office BTM Layout)

View details