Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- #include <iterator>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- long long mn=1001, n, i; cin >> n;
- map<string, long long> log;
- string name;
- for(i=0; i<n; ++i){
- cin >> name;
- ++log[name];
- }
- for(auto it:log) if(it.second<mn){
- mn=it.second;
- name=it.first;
- } else if(it.second==mn&&it.first>name) name=it.first;
- cout << name;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement