Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- map<string,int> a;
- int n,mx=0;
- string s,nume;
- int main()
- {
- cin>>n;
- for(int i=1;i<=n;i++)
- {
- cin>>s;
- a[s]++;
- if(a[s]>=mx)
- {mx=a[s];
- nume=s;}
- }
- cout<<nume<<' '<<mx<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement