-
Notifications
You must be signed in to change notification settings - Fork 0
/
CF43A.java
30 lines (29 loc) · 850 Bytes
/
CF43A.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner;
public class CF43A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int team1 = 0;
int team2 = 0;
String team1Name = "";
String team2Name = "";
for(int i = 0; i < n; i++) {
if(i == 0) {
team1Name = sc.next();
team1++;
} else {
String temp = sc.next();
if(temp.equals(team1Name)) team1++;
else {
team2++;
if(team2Name.equals("")) {
team2Name = temp;
}
}
}
}
if(team1 > team2)System.out.println(team1Name);
else System.out.println(team2Name);
sc.close();
}
}