AcWing 3303. 单词分析(Java)
原题链接
简单
作者:
看着我
,
2021-04-10 09:49:12
,
所有人可见
,
阅读 358
import java.util.Scanner;
public class Main_7 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[26];
String string = sc.nextLine();
for (int i = 0; i < string.length(); i++) {
a[string.charAt(i)-'a']++;
}
char m = 'a';
int max = 0;
for (int i = 0; i < a.length; i++) {
if (a[i] > max) {
m = (char) (i + 'a');
max = a[i];
}
}
System.out.println(m);
System.out.println(max);
}
}
转换??
????