fork(1) download
  1. import java.util.*;
  2. import java.util.Map.Entry;
  3.  
  4. class A_Football {
  5. public static void main(String[] args) {
  6. Scanner s = new Scanner(System.in);
  7. Map<String, Integer> points = new HashMap<String, Integer>();
  8. for (int t = s.nextInt(); t-- > 0;) {
  9. String team = s.next();
  10. Integer goals = points.get(team);
  11. if (goals == null) {
  12. goals = 0;
  13. }
  14. points.put(team, goals + 1);
  15. }
  16. int max = Collections.max(points.values());
  17. for(Entry<String, Integer> point : points.entrySet()){
  18. if(point.getValue().equals(max)){
  19. System.out.println(point.getKey());
  20. return;
  21. }
  22. }
  23.  
  24. }
  25. }
  26.  
Success #stdin #stdout 0.07s 213888KB
stdin
1
ABC
stdout
ABC