SHARE
TWEET

Untitled

a guest Mar 26th, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. map<string, long long> M;
  6. string ceva,x;
  7. int main()
  8. {
  9.     long long i, N,maxi=0;
  10.    
  11.    
  12.     cin >> N;
  13.     for (i = 1; i <= N; i++)
  14.     {
  15.         cin >> x;
  16.         M[x]++;if(M[x]>maxi){maxi=M[x];ceva=x;}
  17.         else if(M[x]==maxi) if(ceva>x)ceva=x;
  18.     }
  19.         cout << ceva << " "<<maxi;
  20.    
  21.    
  22.  
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top