单词分析 - 蓝桥云课 (lanqiao.cn)
package lanqiao;
import java.util.Scanner;
public class N504 {
static int[] count = new int[26];
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
for (int i = 0; i < s.length(); i++) {
count[s.charAt(i) - 'a']++;
}
int max = 0;
for (int i = 0; i < count.length; i++) {
if (max < count[i]) {
max = count[i];
}
}
for (int i = 0; i < count.length; i++) {
if (max == count[i]) {
System.out.println((char) (i + 'a'));
System.out.println(count[i]);
break;
}
}
}
}