Repeated characters

0

0 votes
Implementation, Recruit, Basic Programming, Algorithms, Easy, Approved, Basics of Implementation
Problem

You are given a string of length N . Find the most repeated character in the string. If many characters appear same number of times find the smallest one .

Input format
First line contain string S of length N.

Output format
Print the most repeated letter in S.

Input Constraints
1N10

Sample Input
zzraa
Sample Output
a
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Frequency of both 'a' and 'z' is 2 but since 'a' is lexographically smaller than 'z' so the answer is 'a'.

Editor Image

?