import java.util.Comparator; import java.util.LinkedHashMap; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class Main { /** * @param args */ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int maxLen=0; Map<String,Integer> mp=new TreeMap<String, Integer>(); for (int i = 0; i <=n; i++) { String color=sc.nextLine();//以nextLine()输入 int tempNum=mp.get(color)==null ? 0:mp.get(color); mp.put(color, tempNum+1); maxLen=Math.max(maxLen, tempNum+1); } for (String key : mp.keySet()) { if (maxLen==mp.get(key)) { System.out.println(key); } } } }
0.0分
0 人评分
点我有惊喜!你懂得!浏览:2708 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:688 |
数列排序 (C语言代码)浏览:836 |
C语言训练-求函数值 (C语言代码)浏览:581 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:578 |
A+B for Input-Output Practice (III) (C语言代码)浏览:569 |
A+B for Input-Output Practice (VII) (C语言代码)浏览:528 |
图形输出 (C语言代码)浏览:1387 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:683 |
整数平均值 (C语言代码)浏览:787 |