Click Here to go back to the homepage.

Costume Contest Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int results;
    cin >> results;
    map<string, int> map;
    string result;
    while(results--){
        cin >> result;
        auto it = map.find(result);
        if(it == map.end()){
            map[result] = 1;
        } else {
            ++map[result];
        }
    }
    int minVal = 10000;
    for(auto it:map){
        if(it.second < minVal){
            minVal = it.second;
        }
    }
    vector<string> v;
    for(auto it: map){
        if(it.second == minVal){
            v.push_back(it.first);
        }
    }
    sort(v.begin(), v.end());
    for(string s: v){
        cout << s << endl;
    }

    return 0;   
}