Problem Statement
Create a class called StringDup. Given a string made up of ONLY letters and
digits, determine which character is repeated the most in the string ('A' is
different than 'a'). If there is a tie, the character which appears first in
the string (from left to right) should be returned.
Examples :
aaiicccnn = c
aabbccdd = a
ab2sbf2dj2skl = 2
Here is the method signature :
public char getMax(String input);
We will check to make sure that the input contains only letters and digits (no
punctuation marks or spaces).Definition
- Class:
- StringDup
- Method:
- getMax
- Parameters:
- String
- Returns:
- char
- Method signature:
- char getMax(String param0)
- (be sure your method is public)
Constraints
Examples
No public sample cases were explicitly marked for this problem in the original data.