Submission #4685240


Source Code Expand

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 305 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:3:2: error: ‘cin’ was not declared in this scope
  cin >> L;
  ^
./Main.cpp:5:2: error: ‘string’ was not declared in this scope
  string temp;
  ^
./Main.cpp:6:2: error: ‘map’ was not declared in this scope
  map<string, int> mp;
  ^
./Main.cpp:6:14: error: expected primary-expression before ‘int’
  map<string, int> mp;
              ^
./Main.cpp:8:10: error: ‘str’ was not declared in this scope
   cin >> str;
          ^
./Main.cpp:9:3: error: ‘mp’ was not declared in this scope
   mp[str]++;
   ^
./Main.cpp:13:24: error: ‘mp’ was not declared in this scope
  for(const auto &item: mp){
                        ^
./Main.cpp:15:4: error: ‘str’ was not declared in this scope
    str = item.first;
    ^
./Main.cpp:20:2: error: ‘cout’ was not declared in this scope
  cout << str << endl;
  ^
./Main.cpp:20:10: error: ‘str’ was not declared in this scope
  cout << str << endl;
          ^
./Main.cpp:20:17: error: ‘endl’ was not declared in this scope
  cout ...