728x90
반응형
https://www.acmicpc.net/problem/1302
#include <iostream>
#include <map>
using namespace std;
int main() {
int n, max = 0;
string str, result;
map<string, int> m;
cin >> n;
for(int i = 0; i < n; i++){
cin >> str;
if(m.find(str) != m.end()){
m[str]++;
} else{
m[str] = 1;
}
}
for(auto it = m.begin(); it != m.end(); it++){
if(max < it->second){
max = it->second;
result = it->first;
}
}
cout << result << endl;
return 0;
}
728x90
반응형
'Algorithm > BAEKJOON' 카테고리의 다른 글
[BOJ] 1263번 시간 관리 (C++) (0) | 2022.02.10 |
---|---|
[BOJ] 14490번 백대열 (C++) (0) | 2022.02.06 |
[BOJ] 7656번 만능 오라클 (C++) (0) | 2022.02.05 |
[BOJ] 4358번 생태학 (C++) (0) | 2022.02.04 |
[BOJ] 19583번 싸이버개강총회 (C++) (0) | 2022.02.04 |