Submission #4694590
Source Code Expand
#include<iostream> #include<string> #include<stdio.h> #include<map> using namespace std; int main(){ int L; cin >> L; string temp; map<string, int> mp; for (int i = 0; i < L; i++){ cin >> str; mp[str]++; } int max = 0; for(const auto &item: mp){ if(max < item.second){ str = item.first; max = item.second; } } cout << str << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 投票 |
User | ys0710 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 399 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:13:10: error: ‘str’ was not declared in this scope cin >> str; ^ ./Main.cpp:20:4: error: ‘str’ was not declared in this scope str = item.first; ^ ./Main.cpp:25:10: error: ‘str’ was not declared in this scope cout << str << endl; ^