解题思路:
注意事项:
参考代码:
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); char[] ch = new char[26]; for(int i = 0;i<s.length();i++){ char c = s.charAt(i); ch[c-'a']++; } int ans = 0; int max = 0; for(int i = 0;i<26;i++){ if(ch[i] != 0){ if(ch[i] > max){ max = ch[i]; ans = i; } } } System.out.println((char)(ans+97)+" "+max); } }
0.0分
0 人评分
C语言训练-求素数问题 (C语言代码)浏览:1457 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:751 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1099 |
简单的a+b (C语言代码)浏览:581 |
C二级辅导-同因查找 (C语言代码)浏览:568 |
理财计划 (C语言代码)浏览:468 |
C语言训练-自守数问题 (C语言代码)浏览:748 |
上车人数 (C语言代码)浏览:713 |
平方数问题,oj一直是wrong answer浏览:739 |
C语言程序设计教程(第三版)课后习题8.3 (C++代码)浏览:508 |