-
Notifications
You must be signed in to change notification settings - Fork 52
/
43-A. Football.cpp
48 lines (44 loc) · 879 Bytes
/
43-A. Football.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//============================================================================
//problem link:http://codeforces.com/contest/43/problem/A
// Name : .cpp
// Author : mohand sakr
// Version :
// Copyright : use it under your responsibility
// Description : Hello World in C++, Ansi-style
//status:accepted
//============================================================================
#include <iostream>
#include<map>
#include<string>
using namespace std;
int main() {
int n;
cin>>n;
map<string,int> ma;
map<string,int> ::iterator it;
for(int i=0;i<n;i++){
string s;
cin>>s;
++ma[s];
}
it=ma.begin();
int x=ma.size();
if(x!=1){
int value=(*it).second;
it++;
int value2=(*it).second;
if(value2>value){
cout<<(*it).first;
}
else if(value>value2)
{
it=ma.begin();
cout<<(*it).first;
}
}
else
{
cout<<(*it).first;
}
return 0;
}