Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (24 sloc) 535 Bytes
#include <iostream>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;
int main(void){
const auto times = 5;
map<string, int> answer_map;
for (int cnt = 0; cnt < times; cnt++) {
string str;
getline(cin, str);
answer_map[str] += 1;
}
string answer;
int num = 0;
for (auto pair : answer_map) {
if (pair.second > num) {
answer = pair.first;
num = pair.second;
}
}
cout << answer << endl;
return EXIT_SUCCESS;
}
You can’t perform that action at this time.